springloud+consul进行搭建分布式项目集群框架

推荐一些springcloud+consul做分布式集群的源码

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
springloud+consul进行搭建分布式项目集群框架

推荐一些springcloud+consul做分布式集群的源码

springcloud获取不到consul刷新后个配置

在本地启动了1个 Consul。consul agent -dev 添加了配置 ``` spring: application: name: spring-cloud-consul-ok cloud: consul: host: 127.0.0.1 port: 8500 discovery: enabled: true register: true healthCheckInterval: 15s health-check-timeout: 1s instance-id: ${spring.application.name}-${spring.cloud.consul.host}-${spring.cloud.consul.port} serviecName: ${spring.application.name} config: enabled: true format: YAML data-key: configuration ``` 属性配置类: ``` @Configuration @ConfigurationProperties("sample") @Data @RefreshScope public class SampleProperties { private String prop = "default data"; } ``` 引用方式: ``` @SpringBootApplication @EnableDiscoveryClient @EnableHystrix @RestController @EnableConfigurationProperties @EnableFeignClients @Slf4j public class ConsulAreYouOkApplication { @Autowired private RibbonHelloService ribbonHelloService; @Autowired private SampleProperties sampleProperties; @RequestMapping(value = "/hello", method = RequestMethod.GET) public String areyouok(@RequestParam String name) { return ribbonHelloService.sayHi(name)+" "+sampleProperties.getProp(); } ``` 看着没什么错,但是一直 拿不到 Consul上面的配置,从日志里面 也可以看到Spring已经检测到了 属性的变化,但是就是一直获取不到新值。 版本如下 spring-boot-dependencies 1.5.10.RELEASE spring-cloud-consul-config 1.3.2.RELEASE spring-cloud-starter-consul-discovery 1.3.2.RELEASE

请教一个Consul的问题,代码见图,服务注册是可以成功的,不知道为什么解除注册报了连接错误

请教一个Consul的问题,代码见图,服务注册是可以成功的,不知道为什么解除注册报了连接错误 ConsulClient consulClient = new ConsulClient(nodeHostAdress); Iterator<Map.Entry<String, Service>> it_service = consulClient.getAgentServices().getValue().entrySet().iterator(); java.net.ConnectException: Connection refused (Connection refused) ![图片说明](https://img-ask.csdn.net/upload/201809/18/1537241871_608581.png)

springcloud使用consul作为注册中心时,所注册的服务在访问时是如何保证其负载均衡的?

在很多博客上看到一些关于consul的介绍以及注册实例,但是几乎没有服务的使用实例, 有介绍说使用Feign进行调用,后面试用轮询的方式,那么如果多个请求同时到达, 轮询的第一个服务会不会压力过大?想了解下关于consul到底是怎样实现负载均衡的,拜托了!

Consul集群遇到Encrypti on is configured but remote state is not encrypted

我两台电脑启动consul,并加到同一个集群中,出现以下错误: 2019/12/19 16:12:35 [ERR] memberlist: Push/Pull with n2.dc1 failed: Encrypti on is configured but remote state is not encrypted。 有谁遇到同样的问题没有,麻烦提供下解决方案,谢谢!

consul不同环境配置的问题

如果dev环境consul的配置如下 ``` spring: cloud: consul: host: localhost port: 8500 discovery: hostname: ${spring.cloud.client.ip-address} healthCheckPath: /actuator/health healthCheckInterval: 15s #默认是10s 可设置ps:15s or 1m ip-address: true instanceId: ${spring.application.name}:${spring.cloud.client.ipaddress}:${server.port} tags: ${spring.profiles.active} config: prefix: config enabled: true #默认是true -- format: YAML # 表示consul上面文件的格式 有四种 YAML PROPERTIES KEY-VALUE FILES defaultContext: demo-server # 表示配置文件对应的应用名称 data-key: data #表示consul上面的KEY值(或者说文件的名字) 默认是data profileSeparator: '-' ``` 那么请问在pre环境下。(服务器地址120.78.8.111) cunsul的配置,尤其是host应该怎么配?

consul+zuul 总是转发到不健康节点

****![图片说明](https://img-ask.csdn.net/upload/201903/16/1552726608_932541.png) consul agent -dev 模式下 ![图片说明](https://img-ask.csdn.net/upload/201903/16/1552728412_755468.png) 搭建了 几个微服务,注册到consul (V1.4.3)上 现在几个微服务重启后,在consul的健康页面上查看几个微服务状态很奇怪 使用zuul进行转发访问都是找不到service-id 通过请求 http://localhost:19003/actuator/health 查看,服务状态都是down的,想问下是怎么回事? ![图片说明](https://img-ask.csdn.net/upload/201903/16/1552727091_724995.png) 注:第一次从头再来,都是正常up的,只要一重启某个服务,就某个服务异常了。 下面为配置: ## admin-service ![图片说明](https://img-ask.csdn.net/upload/201903/16/1552727061_731723.png) ## gateway-service ![图片说明](https://img-ask.csdn.net/upload/201903/16/1552727072_807091.png) 请求:localhost:19002/admin/getTest ![图片说明](https://img-ask.csdn.net/upload/201903/16/1552727274_971412.png)****

Consul读取超时出错,实力不够,解决不了,请大神帮忙

![图片说明](https://img-ask.csdn.net/upload/201908/27/1566876212_98723.png)

从Consul获得的具有持久连接的gRPC服务的客户端注册表

<div class="post-text" itemprop="text"> <p>I have a Go service which is pluggable and based on the plugin serve different purposes. At the start it's register the address and port into the Consul's service discovery and it's tags like <code>plugin1</code>, <code>plugin2</code>, <code>plugin3</code>, etc. </p> <p>On the client-side I want to connect to the services based on the plugin what it implements. I can get them from consul, call the <code>grpc.Dial</code> and pass it to the proto's client implementation. When I call the right endpoint I just close the connection and go on. </p> <p>The problem with this, the <code>grpc.Dial</code> can be a reusable connection, so not necessary to call it anytime when I want to connect to a service, but it's too dynamic to have a persistent connection to the services, because services could be removed or new services can appear. </p> <p>What is the best way to have persistent connection to the services based on this requirements/problems?</p> </div>

请教微服务与分布式问题

现在用的是这两个go-micro consul 有一个加减用户积分的微服务 <用户微服务> 加减积分在服务中直接进行 很多服务现在 依赖 用户微服务 ,现在怎么更新,重启而不影响其他服务呢 如果启动两个用户实例, 两个实例之间的用户积分怎么同步呢 请问,你们都是怎么处理的呢

以编程方式启动的Consul代理无法打开HTTP端口

<div class="post-text" itemprop="text"> <p>I try to start a Consul agent using their Golang <a href="http://github.com/hashicorp/consul/command/agent" rel="nofollow">package</a>. The server itself comes up but I can't interact with it because it does not start to listen for incoming HTTP requests.</p> <p>My code to start the agent:</p> <pre><code>//create the logwriter writer := bytes.NewBuffer(server.log) agentConfig := agent.DefaultConfig() agentConfig.BindAddr = "127.0.0.1" agentConfig.DevMode = true agentConfig.Bootstrap = true agentConfig.Server = true agentConfig.DataDir = "/tmp" agentConfig.Ports.HTTP = 8500 agentConfig.Ports.HTTPS = -1 //agentConfig.AdvertiseAddr = "127.0.0.1" //agentConfig.EnableUi = true agentConfig.Addresses.HTTP = "127.0.0.1" glog.Infof("Agent config: %+v", agentConfig) agent, err := agent.Create(agentConfig, writer) if err != nil { t.Fatalf("Error starting consul agent: %v", err) } </code></pre> <p>The resulting configuration on start looks like:</p> <pre><code>Agent config: &amp;{DevMode:true Bootstrap:true BootstrapExpect:0 Server:true Datacenter:dc1 DataDir:/tmp DNSRecursor: DNSRecursors:[] DNSConfig:{NodeTTL:0 NodeTTLRaw: ServiceTTL:map[] ServiceTTLRaw:map[] AllowStale:false EnableTruncate:false UDPAnswerLimit:3 MaxStale:5s MaxStaleRaw: OnlyPassing:false} Domain:consul. EncryptKey: LogLevel:INFO NodeName: ClientAddr:127.0.0.1 BindAddr:127.0.0.1 AdvertiseAddr: AdvertiseAddrs:{SerfLan:&lt;nil&gt; SerfLanRaw: SerfWan:&lt;nil&gt; SerfWanRaw: RPC:&lt;nil&gt; RPCRaw:} AdvertiseAddrWan: TranslateWanAddrs:false Ports:{DNS:8600 HTTP:8500 HTTPS:-1 RPC:8400 SerfLan:8301 SerfWan:8302 Server:8300} Addresses:{DNS: HTTP:127.0.0.1 HTTPS: RPC:} TaggedAddresses:map[] LeaveOnTerm:false SkipLeaveOnInt: &lt;nil&gt; Telemetry:{StatsiteAddr: StatsdAddr: StatsitePrefix:consul DisableHostname:false DogStatsdAddr: DogStatsdTags:[]} Protocol:2 EnableDebug:false VerifyIncoming:false VerifyOutgoing:false VerifyServerHostname:false CAFile: CertFile: KeyFile: ServerName: StartJoin:[] StartJoinWan:[] RetryJoin:[] RetryMaxAttempts:0 RetryInterval:30s RetryIntervalRaw: RetryJoinWan:[] RetryMaxAttemptsWan:0 RetryIntervalWan:30s RetryIntervalWanRaw: ReconnectTimeoutLan:0 ReconnectTimeoutLanRaw: ReconnectTimeoutWan:0 ReconnectTimeoutWanRaw: EnableUi:false UiDir: PidFile: EnableSyslog:false SyslogFacility:LOCAL0 RejoinAfterLeave:false CheckUpdateInterval:5m0s CheckUpdateIntervalRaw: ACLToken: ACLMasterToken: ACLDatacenter: ACLTTL:30s ACLTTLRaw: ACLDefaultPolicy:allow ACLDownPolicy:extend-cache Watches:[] DisableRemoteExec:false DisableUpdateCheck:false DisableAnonymousSignature:false HTTPAPIResponseHeaders:map[] AtlasInfrastructure: AtlasToken: AtlasACLToken: AtlasJoin:false AtlasEndpoint: AEInterval:1m0s DisableCoordinates:false SyncCoordinateRateTarget:64 SyncCoordinateIntervalMin:15s Checks:[] Services:[] ConsulConfig:&lt;nil&gt; Revision: Version: VersionPrerelease: WatchPlans:[] UnixSockets:{UnixSocketPermissions:{Usr: Grp: Perms:}} SessionTTLMin:0 SessionTTLMinRaw: Reap:&lt;nil&gt;} </code></pre> <p>Checking my open ports I can see that the agent is up but not listening for HTTP</p> <pre><code>storage.t 16820 felix 5u IPv4 469866 0t0 TCP localhost:8300 (LISTEN) storage.t 16820 felix 6u IPv4 469867 0t0 TCP localhost:8301 (LISTEN) storage.t 16820 felix 7u IPv4 469868 0t0 UDP localhost:8301 storage.t 16820 felix 8u IPv4 469869 0t0 TCP localhost:8302 (LISTEN) storage.t 16820 felix 9u IPv4 469870 0t0 UDP localhost:8302 </code></pre> <p>Every tip to get that running is appreciated :)</p> </div>

在Docker HTTP运行状况检查上运行的Consul返回“对等连接重置”

<div class="post-text" itemprop="text"> <p>We are running consul through docker and using the HTTP health checks to a URL (<a href="https://10.1.24.68:5012/status" rel="nofollow">https://10.1.24.68:5012/status</a>) with a self-signed certificate. However, I get the following error:</p> <blockquote> <p>2016/06/10 10:29:42 [WARN] agent: http request failed '<a href="https://10.1.24.68:5012/status" rel="nofollow">https://10.1.24.68:5012/status</a>': Get <a href="https://10.1.24.68:5012/status" rel="nofollow">https://10.1.24.68:5012/status</a>: read tcp 10.3.2.11:55549-&gt;10.1.24.68:5012: read: connection reset by peer</p> </blockquote> <p>It works as well when we use the Script health check with the <code>wget</code> command but this is not ideal. <a href="https://github.com/hashicorp/consul/blob/14ec46b3cf8edf6fdd3f4bda8deacdfb6d4e9a73/command/agent/check.go#L426" rel="nofollow">This</a> is the line of code in Consul throwing the above error.</p> <p>When running the health check to a HTTP URL (<a href="http://localhost:5012/status" rel="nofollow">http://localhost:5012/status</a>) it works. Could this be a certificate issue? I've added our certificate to both <code>/etc/ssl/certs/ca-certificates.crt</code> and <code>/usr/share/local/ca-certificates.crt</code>.</p> <p>Halp!</p> </div>

spring boot 2.1.1.RELEASE 不支持consul

最近使用consul作为spring cloud的服务发现,一直不能把服务注册到consul上,发生spring boot使用的是2.1.1.RELEASE版本,后来改成2.0.3.RELEASE能够注册成功。 spring cloud使用Finchley.RELEASE或者Finchley.SR2没有影响。 分别使用consul1.2.1,1.3.1,1.4测试了,结果一样。 哪位同学知道为什么?

急!有没有比较好的ActiveMQ高可用集群配置策略

之前用的zookeeper+leveldb的集群,三台机器,随机关闭一台机器重启不能正常恢复服务,集群直接就崩了,报的No IOExceptionHandler registered,后来查的说现在apache已经弃用leveldb的了 所以现在高可用都是什么配置策略呢?大家给些指导吧

关于consul启动的错误

![这个该怎么解决呀。。刚解压出来的。图片说明](https://img-ask.csdn.net/upload/201710/02/1506936390_415273.png)

spring cloud spring boot 中使用zuul+consul, zuul路由不到配置了context-path的服务

spring cloud spring boot 中使用zuul+consul, zuul路由不到配置了context-path的客户端,不配置context-path可以路由。 网关配置: ![图片说明](https://img-ask.csdn.net/upload/201908/12/1565579622_88622.jpg) 被调用服务配置: ![图片说明](https://img-ask.csdn.net/upload/201908/12/1565579556_555688.jpg) 网关调用报错:![图片说明](https://img-ask.csdn.net/upload/201908/12/1565579883_859782.jpg)

如何使用逗号连接领事模板的服务元数据

<div class="post-text" itemprop="text"> <p>Does anyone know how to concatenate strings from consul for consul-template? </p> <p>If I have a service 'foo' registered in Consul</p> <pre><code>{ "Node": "node1", "Address": "192.168.0.1", "Port": 3333 }, { "Node": "node2", "Address": "192.168.0.2", "Port": 4444 } </code></pre> <p>I would like consul-template to generate the following line:</p> <pre><code>servers=192.168.0.1:3333,192.168.0.2:4444/bogus </code></pre> <p>The following attempt does not work since it leaves a trailing comma <code>,</code></p> <pre><code>servers={{range service "foo"}}{{.Address}}{{.Port}},{{end}}/bogus # renders servers=192.168.0.1:3333,192.168.0.2:4444,/bogus # What I actually want servers=192.168.0.1:3333,192.168.0.2:4444/bogus </code></pre> <p>I know consul-template uses golang template syntax, but I simply cannot figure out the syntax to get this working. Its likely that I should use consul-template's <code>join</code> but how do I pass both <code>.Address</code> and <code>.Port</code> to <code>join</code>? This is just a trivial example, and I'm not using indexes intentionally since the number of services could be more than two. Any ideas?</p> </div>

API网关报错负载均衡器不能找到客户端的服务器?Consul+zuul

直接上错误信息:其中svms-file-8585时我的另一个服务id ``` Registering service with consul: NewService{id='svms-file-8585', name='svms-file', tags=[serverType=2, secure=false], address='172.16.128.95', meta=null, port=8585, enableTagOverride=null, check=Check{script='null', interval='10s', ttl='null', http='http://172.16.128.95:8585/health', method='null', header={}, tcp='null', timeout='null', deregisterCriticalServiceAfter='null', tlsSkipVerify=null, status='null'}, checks=null} ``` ------------------------------------------------------------ ``` com.netflix.zuul.exception.ZuulException: Forwarding error at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.handleException(RibbonRoutingFilter.java:198) ~[spring-cloud-netflix-zuul-2.1.1.RELEASE.jar:2.1.1.RELEASE] at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:173) ~[spring-cloud-netflix-zuul-2.1.1.RELEASE.jar:2.1.1.RELEASE] at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:119) ~[spring-cloud-netflix-zuul-2.1.1.RELEASE.jar:2.1.1.RELEASE] at com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:117) ~[zuul-core-1.3.1.jar:1.3.1] at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:193) ~[zuul-core-1.3.1.jar:1.3.1] at com.netflix.zuul.FilterProcessor.runFilters(FilterProcessor.java:157) ~[zuul-core-1.3.1.jar:1.3.1] at com.netflix.zuul.FilterProcessor.route(FilterProcessor.java:118) ~[zuul-core-1.3.1.jar:1.3.1] at com.netflix.zuul.ZuulRunner.route(ZuulRunner.java:96) ~[zuul-core-1.3.1.jar:1.3.1] at com.netflix.zuul.http.ZuulServlet.route(ZuulServlet.java:116) ~[zuul-core-1.3.1.jar:1.3.1] at com.netflix.zuul.http.ZuulServlet.service(ZuulServlet.java:81) ~[zuul-core-1.3.1.jar:1.3.1] at org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:165) [spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.cloud.netflix.zuul.web.ZuulController.handleRequest(ZuulController.java:45) [spring-cloud-netflix-zuul-2.1.1.RELEASE.jar:2.1.1.RELEASE] at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:52) [spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) [spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) [spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) [spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897) [spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) [spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-embed-websocket-9.0.16.jar:9.0.16] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90) [spring-boot-actuator-2.1.3.RELEASE.jar:2.1.3.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) [spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) [spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:117) [spring-boot-actuator-2.1.3.RELEASE.jar:2.1.3.RELEASE] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:106) [spring-boot-actuator-2.1.3.RELEASE.jar:2.1.3.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) [spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.16.jar:9.0.16] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_161] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_161] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.16.jar:9.0.16] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_161] Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: svms-file-8585 at com.netflix.loadbalancer.LoadBalancerContext.getServerFromLoadBalancer(LoadBalancerContext.java:483) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0] at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:184) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0] at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0] at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42) ~[rxjava-1.3.8.jar:1.3.8] at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber$1.call(OperatorRetryWithPredicate.java:127) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.enqueue(TrampolineScheduler.java:73) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.schedule(TrampolineScheduler.java:52) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:79) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:45) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.util.ScalarSynchronousObservable$WeakSingleProducer.request(ScalarSynchronousObservable.java:276) ~[rxjava-1.3.8.jar:1.3.8] at rx.Subscriber.setProducer(Subscriber.java:209) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:138) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:129) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.Observable.subscribe(Observable.java:10423) ~[rxjava-1.3.8.jar:1.3.8] at rx.Observable.subscribe(Observable.java:10390) ~[rxjava-1.3.8.jar:1.3.8] at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:443) ~[rxjava-1.3.8.jar:1.3.8] at rx.observables.BlockingObservable.single(BlockingObservable.java:340) ~[rxjava-1.3.8.jar:1.3.8] at com.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:112) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0] at org.springframework.cloud.netflix.zuul.filters.route.support.AbstractRibbonCommand.run(AbstractRibbonCommand.java:221) ~[spring-cloud-netflix-zuul-2.1.1.RELEASE.jar:2.1.1.RELEASE] at org.springframework.cloud.netflix.zuul.filters.route.support.AbstractRibbonCommand.run(AbstractRibbonCommand.java:55) ~[spring-cloud-netflix-zuul-2.1.1.RELEASE.jar:2.1.1.RELEASE] at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302) ~[hystrix-core-1.5.18.jar:1.5.18] at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298) ~[hystrix-core-1.5.18.jar:1.5.18] at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35) ~[rxjava-1.3.8.jar:1.3.8] at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33) ~[rxjava-1.3.8.jar:1.3.8] at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.3.8.jar:1.3.8] at rx.Observable.subscribe(Observable.java:10423) ~[rxjava-1.3.8.jar:1.3.8] at rx.Observable.subscribe(Observable.java:10390) ~[rxjava-1.3.8.jar:1.3.8] at rx.internal.operators.BlockingOperatorToFuture.toFuture(BlockingOperatorToFuture.java:51) ~[rxjava-1.3.8.jar:1.3.8] at rx.observables.BlockingObservable.toFuture(BlockingObservable.java:410) ~[rxjava-1.3.8.jar:1.3.8] at com.netflix.hystrix.HystrixCommand.queue(HystrixCommand.java:378) ~[hystrix-core-1.5.18.jar:1.5.18] at com.netflix.hystrix.HystrixCommand.execute(HystrixCommand.java:344) ~[hystrix-core-1.5.18.jar:1.5.18] at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:167) ~[spring-cloud-netflix-zuul-2.1.1.RELEASE.jar:2.1.1.RELEASE] ... 64 common frames omitted ```

领事上的分布式计数器更新问题

<div class="post-text" itemprop="text"> <p>I'm using consul as a coordinator, and I coordinate completion of DAG branches using consul. Here each branches use a separate process. And to make the completion synchronised I use consul's counter and update with modifyIndex. </p> <p>Although it seems there is some hole in the current implementation of code and the value is same for separate branches after increment. </p> <p>The consul update is implemented as </p> <pre class="lang-golang prettyprint-override"><code>func (consulStore *ConsulStateStore) Update(key string, oldValue string, newValue string) error { key = consulStore.consulKeyPath + "/" + key pair, _, err := consulStore.kv.Get(key, nil) if err != nil { return fmt.Errorf("failed to get key %s, error %v", key, err) } if pair == nil { return fmt.Errorf("failed to get key %s", key) } if string(pair.Value) != oldValue { return fmt.Errorf("Old value doesn't match for key %s", key) } modifyIndex := pair.ModifyIndex p := &amp;consul.KVPair{Key: key, Value: []byte(newValue), ModifyIndex: modifyIndex} _, err = consulStore.kv.Put(p, nil) if err != nil { return fmt.Errorf("failed to update key %s, error %v", key, err) } return nil } </code></pre> <p>My branch execution process calls the below function to increment a counter</p> <pre class="lang-golang prettyprint-override"><code>// IncrementCounter increment counter by given term, if doesn't exist init with incrementby func (fhandler *flowHandler) IncrementCounter(counter string, incrementby int) (int, error) { var serr error count := 0 for i := 0; i &lt; counterUpdateRetryCount; i++ { encoded, err := fhandler.stateStore.Get(counter) if err != nil { // if doesn't exist try to create err := fhandler.stateStore.Set(counter, fmt.Sprintf("%d", incrementby)) if err != nil { return 0, fmt.Errorf("failed to update counter %s, error %v", counter, err) } return incrementby, nil } current, err := strconv.Atoi(encoded) if err != nil { return 0, fmt.Errorf("failed to update counter %s, error %v", counter, err) } count = current + incrementby counterStr := fmt.Sprintf("%d", count) err = fhandler.stateStore.Update(counter, encoded, counterStr) if err == nil { return count, nil } serr = err } return 0, fmt.Errorf("failed to update counter after max retry for %s, error %v", counter, serr) } </code></pre> <p>In the runtime the counter is always initialised before increment</p> </div>

feign的默认负载均衡失效?

在spring Cloud 中,用consul 搭建了两个服务做集群,用feign进行访问,但是一直访问第一台,负载均衡失效,关闭第一台,就能访问到第二台,这时候,开启第一台,后面调用,就不会访问到第一台,只访问第二台.

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

springboot+jwt实现token登陆权限认证

一 前言 此篇文章的内容也是学习不久,终于到周末有时间码一篇文章分享知识追寻者的粉丝们,学完本篇文章,读者将对token类的登陆认证流程有个全面的了解,可以动态搭建自己的登陆认证过程;对小项目而已是个轻量级的认证机制,符合开发需求;更多精彩原创内容关注公主号知识追寻者,读者的肯定,就是对作者的创作的最大支持; 二 jwt实现登陆认证流程 用户使用账号和面发出post请求 服务器接受到请求后使用私...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

程序员写出这样的代码,能不挨骂吗?

当你换槽填坑时,面对一个新的环境。能够快速熟练,上手实现业务需求是关键。但是,哪些因素会影响你快速上手呢?是原有代码写的不够好?还是注释写的不够好?昨夜...

外包程序员的幸福生活

今天给你们讲述一个外包程序员的幸福生活。男主是Z哥,不是在外包公司上班的那种,是一名自由职业者,接外包项目自己干。接下来讲的都是真人真事。 先给大家介绍一下男主,Z哥,老程序员,是我十多年前的老同事,技术大牛,当过CTO,也创过业。因为我俩都爱好喝酒、踢球,再加上住的距离不算远,所以一直也断断续续的联系着,我对Z哥的状况也有大概了解。 Z哥几年前创业失败,后来他开始干起了外包,利用自己的技术能...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

早上躺尸,晚上干活:硅谷科技公司这么流行迟到?

硅谷科技公司上班时间OPEN早已不是什么新鲜事,早九晚五是常态,但有很多企业由于不打卡,员工们10点、11点才“姗姗来迟”的情况也屡见不鲜。 这种灵活的考勤制度为人羡慕,甚至近年来,国内某些互联网企业也纷纷效仿。不过,硅谷普遍弹性的上班制度是怎么由来的呢?这种“流行性迟到”真的有那么轻松、悠哉吗? 《动态规划专题班》 课程试听内容: 动态规划的解题要领 动态规划三大类 求最值/计数/可行性 常...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

Python爬虫,高清美图我全都要(彼岸桌面壁纸)

爬取彼岸桌面网站较为简单,用到了requests、lxml、Beautiful Soup4

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

Java岗开发3年,公司临时抽查算法,离职后这几题我记一辈子

前几天我们公司做了一件蠢事,非常非常愚蠢的事情。我原以为从学校出来之后,除了找工作有测试外,不会有任何与考试有关的事儿。 但是,天有不测风云,公司技术总监、人事总监两位大佬突然降临到我们事业线,叫上我老大,给我们组织了一场别开生面的“考试”。 那是一个风和日丽的下午,我翘着二郎腿,左手端着一杯卡布奇诺,右手抓着我的罗技鼠标,滚动着轮轴,穿梭在头条热点之间。 “淡黄的长裙~蓬松的头发...

大胆预测下未来5年的Web开发

在2019年的ReactiveConf 上,《Elm in Action》的作者Richard Feldman对未来5年Web开发的发展做了预测,很有意思,分享给大家。如果你有机会从头...

立即提问
相关内容推荐