thrift服务端中可否使用多线程,会出现什么问题

thrift服务端可以使用多线程模型,但是由于单个任务很大,时间很长,可以通过在服务端代码中使用多线程来加速处理么?

4个回答

是可以使用多线程的,但涉及到多线程之间的任务处理需要谨慎一点

按以下3个步骤改写服务端(Serv_server.skeleton.cpp)即可实现多线程。

(1)采用线程池的main函数的代码如下:

int main(int argc, char **argv) {
// thread pool
shared_ptr handler(new ServHandler());
shared_ptr processor(new ServProcessor(handler));
shared_ptr protocolFactory(new TBinaryProtocolFactory());
shared_ptr transportFactory(new TBufferedTransportFactory());
shared_ptr serverTransport(new TServerSocket(9090));

// 指定15个线程

shared_ptr threadManager = ThreadManager::newSimpleThreadManager(15);
shared_ptr threadFactory
= shared_ptr(new PosixThreadFactory());

threadManager->threadFactory(threadFactory);
threadManager->start();
printf("start.../n");

TThreadPoolServer server(processor,
serverTransport,
transportFactory,
protocolFactory,
threadManager);

server.serve();

printf("end/n");
return 0;
}

注意代码中的红色关键字,要将他们修改成你自己的service中定义的名字。

(2)头文件:

#include
#include

#include
#include

能加的都加上吧,以免出现类似如下错误:

error: ‘ThreadManager’ was not declared in this scope

(3)命名空间:using namespace ::apache::thrift::concurrency;

否则出现错误:error: ‘PosixThreadFactory’ was not declared in this scope

concurrency是和#include中的文件目录是对应的

每一个客户端连接时,服务端都将启动一个线程为其服务,数据传输结束后,服务端回收这个线程。

参考:https://blog.csdn.net/hbuxiaoshe/article/details/6560285

可以用多线程,注意线程之间数据同步

当然可以,但要注意线程的同步异步问题

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
thrift客户端接收不到服务端数据的问题

安卓用thrift从客户端到服务端获取数据,服务端可以接受到数据,但是客户端接受不到数据,提示未知的结果 Caused by: org.apache.thrift.TApplicationException: getMyPackage failed: unknown result at cn.orientdata.microreminder.iface.MyPackageService$Client.recv_getMyPackage(MyPackageService.java:92) at cn.orientdata.microreminder.iface.MyPackageService$Client.getMyPackage(MyPackageService.java:75) at java.lang.reflect.Method.invoke(Native Method)  at cn.orientdata.microreminder.service.IfaceManager$ProxyHandler.invoke(IfaceManager.java:152)  at java.lang.reflect.Proxy.invoke(Proxy.java:393)  at $Proxy9.getMyPackage(Unknown Source)  at cn.orientdata.microreminder.fragment.HomeFragment$2.call(HomeFragment.java:103)  at cn.orientdata.microreminder.fragment.HomeFragment$2.call(HomeFragment.java:99)  at rx.Observable.unsafeSubscribe(Observable.java:8314)  at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)  at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)  at java.util.concurrent.FutureTask.run(FutureTask.java:237)  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:154)  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)  at java.lang.Thread.run(Thread.java:833)  InvocationTargetException: java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at cn.orientdata.microreminder.service.IfaceManager$ProxyHandler.invoke(IfaceManager.java:152) at java.lang.reflect.Proxy.invoke(Proxy.java:393) at $Proxy9.getMyPackage(Unknown Source) at cn.orientdata.microreminder.fragment.HomeFragment$2.call(HomeFragment.java:103) at cn.orientdata.microreminder.fragment.HomeFragment$2.call(HomeFragment.java:99) at rx.Observable.unsafeSubscribe(Observable.java:8314) at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94) at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:154) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:833)

thrift使用TThreadPoolServer时出现undefined

thrift使用时编译服务端出现了TThreadPoolServer的构造问题,这里无故出现的boost::shared_ptr类型问题,在之前编译过程中一直没有出现问题,直到重新编译thrift之后才出现类似问题 undefined reference to `apache::thrift::server::TThreadPoolServer::TThreadPoolServer(boost::shared_ptr<apache::thrift::TProcessor> const&, boost::shared_ptr<apache::thrift::transport::TServerTransport> const&, boost::shared_ptr<apache::thrift::transport::TTransportFactory> const&, boost::shared_ptr<apache::thrift::protocol::TProtocolFactory> const&, boost::shared_ptr<apache::thrift::concurrency::ThreadManager> const&)' undefined reference to `apache::thrift::concurrency::PosixThreadFactory::newThread(boost::shared_ptr<apache::thrift::concurrency::Runnable>) const'

请问thrift 0.9.2 在大并发情况下能否保证先发出的信息能够被服务端先收到???

请问thrift 0.9.2 在大并发情况下能否保证先发出的信息能够被服务端先收到??? 最近在做一个服务端和客户端一致性的中间件,这个问题困扰好久,请大牛指点。

PHP客户端和Golang服务器中的Apache Thrift错误

<div class="post-text" itemprop="text"> <p>when i use Apache Thrift PHP client and PHP server is OK, but When I use Golang as Server, is not OK, I find nothing in the internet that about Golang thrift use Http mode,The document only show the usage about socket mode in Golang,so i need help.</p> <p>php server code(use laravel5.2, thrift 0.11.0):</p> <pre><code> try{ header('Content-Type', 'application/x-thrift'); $dokuHandler = new DokuService(); $multiplexedProcessor = new TMultiplexedProcessor(); // 创建多个服务Processor $dokuProcessor = new DokuServiceProcessor($dokuHandler); // 将服务注册到TMultiplexedProcessor中 $multiplexedProcessor-&gt;registerProcessor("doku", $dokuProcessor); // 初始化数据传输方式transport $transport = new TBufferedTransport(new TPhpStream(TPhpStream::MODE_R | TPhpStream::MODE_W)); // 利用该传输方式初始化数据传输格式protocol $protocol = new TBinaryProtocol($transport, true, true); // 开始服务 $transport-&gt;open(); $multiplexedProcessor-&gt;process($protocol, $protocol); } catch (\TException $exception) { Log::error("DokuService handleRequest", [ 'request' =&gt; $request, 'exMsg' =&gt; $exception-&gt;getMessage(), 'exStack' =&gt; $exception-&gt;getTraceAsString(), ]); } finally { if ($transport) { $transport-&gt;close(); } } </code></pre> <p>php client code:</p> <pre><code>public function __construct() { $this-&gt;transport = null; try { $uri = '/rpc/outgo/server'; $serviceName = 'outgo'; $host = self::getHost(); $port = self::getPort(); $socket = new THttpClient($host, $port, $uri); $this-&gt;transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($this-&gt;transport); $this-&gt;multiplexedProtocol = new TMultiplexedProtocol($protocol, $serviceName); parent::__construct($this-&gt;multiplexedProtocol); } catch (\Exception $e) { Log::error('construct OutgoRpcClient error', [ 'host' =&gt; $host, 'port' =&gt; $port, 'serviceName' =&gt; $serviceName, 'ex_msg' =&gt; $e-&gt;getMessage(), 'ex_trace' =&gt; $e-&gt;getTraceAsString(), ]); } } </code></pre> <p>golang server code(go1.10.3, gin framework,):</p> <pre><code>func RpcReceive(c *gin.Context) { //defer func() { // if err := recover(); err != nil { // config.LogRecord.WithFields(logrus.Fields{"error": err}).Error("rpc worker error") // } //}() var transport thrift.TTransport newTransport, err := thrift.NewTBufferedTransportFactory(10).GetTransport(transport) if err != nil { panic("new transport error") } protocol := thrift.NewTBinaryProtocolFactoryDefault().GetProtocol(newTransport) orderProcessor := orderservice.NewOrderServiceProcessor(new(orderService)) OrderServiceName := "outgo" multiProcessor := thrift.NewTMultiplexedProcessor() multiProcessor.RegisterProcessor(OrderServiceName, orderProcessor) newTransport.Open() multiProcessor.Process(c, protocol, protocol) //newTransport.Close() } </code></pre> <p>golang err:</p> <pre><code> runtime error: invalid memory address or nil pointer dereference /usr/local/opt/go/libexec/src/runtime/panic.go:502 (0x102ad08) gopanic: reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz)) /usr/local/opt/go/libexec/src/runtime/panic.go:63 (0x1029d7d) panicmem: panic(memoryError) /usr/local/opt/go/libexec/src/runtime/signal_unix.go:388 (0x1040279) sigpanic: panicmem() /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/git.apache.org/thrift.git/lib/go/thrift/buffered_transport.go:58 (0x18c180a) (*TBufferedTransport).Open: return p.tp.Open() /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/app/http/controller/rpc/receiveBusiness.go:86 (0x18ce4cf) RpcReceive: newTransport.Open() /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/context.go:104 (0x1537b42) (*Context).Next: c.handlers[c.index](c) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/app/http/middleware/catchPanic.go:41 (0x16b2e20) RecoveryWithWriter.func1: c.Next() /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/context.go:104 (0x1537b42) (*Context).Next: c.handlers[c.index](c) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/app/http/middleware/commonMw.go:16 (0x16b40a4) Logger.func1: c.Next() /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/context.go:104 (0x1537b42) (*Context).Next: c.handlers[c.index](c) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/gin.go:332 (0x153ebe4) (*Engine).handleHTTPRequest: context.Next() /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/gin.go:296 (0x153e432) (*Engine).ServeHTTP: engine.handleHTTPRequest(c) /usr/local/opt/go/libexec/src/net/http/server.go:2694 (0x128093b) serverHandler.ServeHTTP: handler.ServeHTTP(rw, req) /usr/local/opt/go/libexec/src/net/http/server.go:1830 (0x127caf0) (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req) /usr/local/opt/go/libexec/src/runtime/asm_amd64.s:2361 (0x1057030) goexit: BYTE $0x90 // NOP ] &lt;nil&gt;} goroutine 33 [running]: net/http.(*conn).serve.func1(0xc4202da000) /usr/local/opt/go/libexec/src/net/http/server.go:1726 +0xd0 panic(0x1b06940, 0xc42033e5a0) /usr/local/opt/go/libexec/src/runtime/panic.go:502 +0x229 github.com/rule-engine/rule-engine/vendor/github.com/sirupsen/logrus.Entry.log(0xc4200d52c0, 0xc4202f4630, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/sirupsen/logrus/entry.go:126 +0x2d2 github.com/rule-engine/rule-engine/vendor/github.com/sirupsen/logrus.(*Entry).Panic(0xc42033e410, 0xc42056b640, 0x1, 0x1) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/sirupsen/logrus/entry.go:194 +0xaa github.com/rule-engine/rule-engine/vendor/github.com/sirupsen/logrus.(*Logger).Panic(0xc4200d52c0, 0xc42056b640, 0x1, 0x1) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/sirupsen/logrus/logger.go:244 +0x6d github.com/rule-engine/rule-engine/app/http/middleware.RecoveryWithWriter.func1.1(0xc42037e580) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/app/http/middleware/catchPanic.go:35 +0x46b panic(0x19db200, 0x21320b0) /usr/local/opt/go/libexec/src/runtime/panic.go:502 +0x229 github.com/rule-engine/rule-engine/vendor/git.apache.org/thrift.git/lib/go/thrift.(*TBufferedTransport).Open(0xc420248080, 0xc4202f4510, 0x1b241cf) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/git.apache.org/thrift.git/lib/go/thrift/buffered_transport.go:58 +0x2a github.com/rule-engine/rule-engine/app/http/controller/rpc.RpcReceive(0xc42037e580) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/app/http/controller/rpc/receiveBusiness.go:86 +0x370 github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin.(*Context).Next(0xc42037e580) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/context.go:104 +0x43 github.com/rule-engine/rule-engine/app/http/middleware.RecoveryWithWriter.func1(0xc42037e580) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/app/http/middleware/catchPanic.go:41 +0x51 github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin.(*Context).Next(0xc42037e580) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/context.go:104 +0x43 github.com/rule-engine/rule-engine/app/http/middleware.Logger.func1(0xc42037e580) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/app/http/middleware/commonMw.go:16 +0x85 github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin.(*Context).Next(0xc42037e580) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/context.go:104 +0x43 github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc4200dc6c0, 0xc42037e580) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/gin.go:332 +0x585 github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc4200dc6c0, 0x1c29ae0, 0xc42038c000, 0xc42015a000) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/gin.go:296 +0x153 net/http.serverHandler.ServeHTTP(0xc4200dc7e0, 0x1c29ae0, 0xc42038c000, 0xc42015a000) /usr/local/opt/go/libexec/src/net/http/server.go:2694 +0xbc net/http.(*conn).serve(0xc4202da000, 0x1c2a860, 0xc4201da4c0) /usr/local/opt/go/libexec/src/net/http/server.go:1830 +0x651 created by net/http.(*Server).Serve /usr/local/opt/go/libexec/src/net/http/server.go:2795 +0x27b </code></pre> <p>I refer php server to write golang server code.</p> </div>

thrift常连接时间久了收不到数据

我用C#作为服务端使用thrift框架,然后用java作为客户端做常连接高并发调用,大约每30秒12000条数据,每条数据不超过255个字节。持续5分钟之后,java端发送数据依然正常,但是C#端收不到数据,C#所在服务器使用tcp抓包工具可以抓到,只是服务端程序收不到信息,请大神们帮忙解答!

为Go生成多个Thrift文件的正确方法

<div class="post-text" itemprop="text"> <p>So I have the following files</p> <pre><code>/src/baseService.thrift /baseTypes.thrift /baseSecurity.thrift </code></pre> <p>I want all of these thrift definitions to be created into one library. The top of each file is thus:</p> <pre><code>baseService.thrift ================== namespace java foo.bar namespace cpp foo.bar namespace js foo.bar namespace go foo.bar import "baseTypes.thrift" baseTypes.thrift ================ namespace java foo.bar namespace cpp foo.bar namespace js foo.bar namespace go foo.bar baseSecurity.thrift =================== namespace java foo.bar namespace cpp foo.bar namespace js foo.bar namespace go foo.bar import "baseTypes.thrift" </code></pre> <p>The problem is, how to I create all of these into one lib package? It works fine for java/cpp/js but when I try to build for go it's a no go.</p> <p>With thrift, you can't do a <code>thrift gen:baz *.thrift</code>, you have to do the files one at a time. For the other languages, we just do a:</p> <pre><code>for f in `find *.thrift`; do thrift -o myGenDir --gen go $f" done </code></pre> <p>(substitute appropriate gen command for each lang)</p> <p>For Python this is fine because it puts every gen'd file in it's own dir based on the filename [ i.e. foo/bar/{filename}/ttypes.py]. For Java it dumps all of the files in foo/bar/ but every class name is unique. For cpp, it dumps it all into the gen dir, but uniquely named per thrift file [so {filename.h}, {filename.cpp}]. For Go, however, it dumps everything into foo/bar like so:</p> <pre><code>/foo/bar/constants.go /foo/bar/service.go /foo/bar/service-remote/ /foo/bar/baz/ [for anything that has a namespace of foo.bar.baz] /foo/bar/ttypes.go </code></pre> <p>The problem is, the ttypes.go and (presumably) constants.go are getting overwritten by whatever is gen'd last in the for loop. Is there a way around this? It works for the other languages - seems like it's an oversight for Go. What am I missing. We've got lots of Thrift files with lots of stuff in them - I'd rather not have to combine everything that's at the same package level into one thrift file.</p> </div>

Visual studio中使用thrift做客户端,如何导入thrift的第三方依赖?

项目--> C++目录--> 包含目录 选择boost包含目录,thrift包含目录,openssl包含目录; 在main中引入thrift通信要用的头文件: #include "stdafx.h" #include <thrift/transport/TSocket.h> #include <thrift/transport/TBufferTransports.h> #include <thrift/protocol/TBinaryProtocol.h> using namespace apache::thrift; using namespace apache::thrift::protocol; using namespace apache::thrift::transport; using namespace std; using boost::shared_ptr; //#pragma comment(lib, "libthrift.lib") //#pragma comment(lib, "libeay32.lib") //#pragma comment(lib, "ssleay32.lib") int main(int argc, char **argv) { boost::shared_ptr<TSocket> socket(new TSocket("localhost", 9090)); return 0; } 运行有错误: ThriftClientTest.obj : error LNK2001: 无法解析的外部符号 "public: __cdecl apache::thrift::transport::TSocket::TSocket(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" (??0TSocket@transport@thrift@apache@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) 不知道这是什么原因造成的?谁能帮我解答一下吗

thrift生成java文件报错

现在linux机器,安装thrift ``` [root@localhost workspace]# thrift -version Thrift version 0.14.0 ``` 然后编写hello.thrift文件 ``` service HelloService { string sayHello (1: string name); } ``` 再执行 ``` thrift -gen java hello.thrift ``` 然后打开当前目录下HelloService.java 把文件放到eclipse下,开始编写服务端和客户端 发现报错 ![图片说明](https://img-ask.csdn.net/upload/201912/10/1575945621_252555.png) ![图片说明](https://img-ask.csdn.net/upload/201912/10/1575945629_175679.png) maven的pom文件: ``` <dependency> <groupId>org.apache.thrift</groupId> <artifactId>libthrift</artifactId> <version>0.10.0</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.5</version> </dependency> ``` 网友们知道什么原因吗,百度也没查到对应问题

python 用thrift 连接hbase数据库出现Error Broken pipe

最近做一些数据处理,使用python处理, 用thrift 连接hbase数据库出现Error Broken pipe,每次出现错误得重新启动才行,出现错误的时间不一,有的时候十几个小时,有得八个小时,有的二个小时,重定向输出也不行,修改HBASE数据库超时时间也不行,试了好多方法都不行,恳请大家帮忙解决这个问题

C#调用Thrift出现Thrift.TApplicationException

最近用C#客户端调用Curator RPC Proxy服务,远程与zookeeper通信。客户端与RPC Proxy之间通信用Thrift,Thrift文件是从官网下载且能正常编译使用。 实现以下两个功能: (1)监听zookeeper中特定node事件,包括增、删、改等信息; ![图片说明](https://img-ask.csdn.net/upload/201501/09/1420764037_326591.png) (2)从客户端按下按钮,增加一个新node。 ![图片说明](https://img-ask.csdn.net/upload/201501/09/1420764119_695395.png) 现在第一个功能已正常实现,第二个在铵下后出现如下错误,且界面死机。 ![图片说明](https://img-ask.csdn.net/upload/201501/09/1420764189_40320.png) 自己添加的所有代码如下: ``` public partial class Form1 : Form { //CuratorService CuratorService.Client curatorService = null; EventService.Client eventService = null; CuratorProjection curatorProjection = null; CuratorProjection projection2 = null; //TTransport type TTransport transport = null; TProtocol protocol = null; //Thread operation function public static void eventCycle( object obj, object obj2, object obj3){ CuratorProjection projection = (CuratorProjection)obj; EventService.Client eventService = (EventService.Client)obj2; CuratorService.Client curatorService = (CuratorService.Client)obj3; PathChildrenCacheProjection cacheProjection = curatorService.startPathChildrenCache( projection, "/root", true, false, PathChildrenCacheStartMode.BUILD_INITIAL_CACHE ); while(Thread.CurrentThread.IsAlive){ try { CuratorEvent remoteEvent = eventService.getNextEvent(projection); if (CuratorEventType.PING == remoteEvent.Type) { Console.WriteLine("Heartbeat"); } else if (CuratorEventType.PATH_CHILDREN_CACHE == remoteEvent.Type) { if (PathChildrenCacheEventType.CHILD_ADDED == remoteEvent.ChildrenCacheEvent.Type) { ChildData child = remoteEvent.ChildrenCacheEvent.Data; String path = child.Path; Console.WriteLine("Children Added " + path); } else if (PathChildrenCacheEventType.CHILD_REMOVED == remoteEvent.ChildrenCacheEvent.Type) { ChildData child = remoteEvent.ChildrenCacheEvent.Data; String path = child.Path; Console.WriteLine("Child Deleted: " + path); } } }catch( TTransportException transError) { Console.WriteLine( transError.Data ); }catch( TException tError ) { if( tError is TApplicationException ) Console.WriteLine(tError.Data); } } } public Form1() { InitializeComponent(); transport = new TSocket( "127.0.0.1", 1234 ); transport.Open(); protocol = new TBinaryProtocol( transport ); curatorService = new CuratorService.Client( protocol ); eventService = new EventService.Client( protocol ); curatorProjection = curatorService.newCuratorProjection("main"); projection2 = curatorService.newCuratorProjection("main"); Thread eventListener = new Thread(delegate() { eventCycle(curatorProjection, eventService, curatorService); }); eventListener.Start(); } private void button1_Click(object sender, EventArgs e) { try { CreateSpec node = new CreateSpec(); node.Path = "/root/xm"; node.Data = Encoding.Default.GetBytes("XM"); node.Mode = CreateMode.PERSISTENT_SEQUENTIAL; node.CreatingParentsIfNeeded = true; OptionalPath path = curatorService.createNode( projection2, node ); if(null != path) Console.WriteLine( path.ToString() ); }catch( TTransportException error){ Console.WriteLine( error.Data ); }catch( TApplicationException tError){ Console.WriteLine( tError.Data ); } } } ```

Thrift编译器(0.9.3)生成Thrift包中未定义的函数thrift.PrependError

<div class="post-text" itemprop="text"> <p>I use <code>thrift</code> compiler (0.9.3) to generate gen-go folder, while the compiler generates a function <code>thrift.PrependError</code> which can't be found in <code>thrift</code> package (<code>git.apache.org/thrift.git/lib/go/thrift</code>). </p> <p>Should I use <code>thrift</code> compiler (0.9.2)?</p> </div>

thrift 编译 BUG thrift小白提问

求大神帮忙看看什么问题 ``` /home/testThrtift/gen-cpp/serDemo_server.skeleton.cpp:36:对‘apache::thrift::server::TSimpleServer::TSimpleServer(boost::shared_ptr<apache::thrift::TProcessor> const&, boost::shared_ptr<apache::thrift::transport::TServerTransport> const&, boost::shared_ptr<apache::thrift::transport::TTransportFactory> const&, boost::shared_ptr<apache::thrift::protocol::TProtocolFactory> const&)’未定义的引用 ``` 为什么会提示这个BUG? 刚刚开始用thrift,版本是0.12

PHP客户端和Golang Server中的Apache thrift错误

<div class="post-text" itemprop="text"> <p>when i use Apache Thrift PHP client and PHP server is OK, but When I use Golang as Server, is not OK, I find nothing in the internet that about Golang thrift use Http mode,The document only show the usage about socket mode in Golang,so i need help.</p> <p>php server code(use laravel5.2, thrift 0.11.0):</p> <pre><code> try{ header('Content-Type', 'application/x-thrift'); $dokuHandler = new DokuService(); $multiplexedProcessor = new TMultiplexedProcessor(); // 创建多个服务Processor $dokuProcessor = new DokuServiceProcessor($dokuHandler); // 将服务注册到TMultiplexedProcessor中 $multiplexedProcessor-&gt;registerProcessor("doku", $dokuProcessor); // 初始化数据传输方式transport $transport = new TBufferedTransport(new TPhpStream(TPhpStream::MODE_R | TPhpStream::MODE_W)); // 利用该传输方式初始化数据传输格式protocol $protocol = new TBinaryProtocol($transport, true, true); // 开始服务 $transport-&gt;open(); $multiplexedProcessor-&gt;process($protocol, $protocol); } catch (\TException $exception) { Log::error("DokuService handleRequest", [ 'request' =&gt; $request, 'exMsg' =&gt; $exception-&gt;getMessage(), 'exStack' =&gt; $exception-&gt;getTraceAsString(), ]); } finally { if ($transport) { $transport-&gt;close(); } } </code></pre> <p>php client code:</p> <pre><code>public function __construct() { $this-&gt;transport = null; try { $uri = '/rpc/outgo/server'; $serviceName = 'outgo'; $host = self::getHost(); $port = self::getPort(); $socket = new THttpClient($host, $port, $uri); $this-&gt;transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($this-&gt;transport); $this-&gt;multiplexedProtocol = new TMultiplexedProtocol($protocol, $serviceName); parent::__construct($this-&gt;multiplexedProtocol); } catch (\Exception $e) { Log::error('construct OutgoRpcClient error', [ 'host' =&gt; $host, 'port' =&gt; $port, 'serviceName' =&gt; $serviceName, 'ex_msg' =&gt; $e-&gt;getMessage(), 'ex_trace' =&gt; $e-&gt;getTraceAsString(), ]); } } </code></pre> <p>golang server code(go1.10.3, gin framework,):</p> <pre><code>func RpcReceive(c *gin.Context) { //defer func() { // if err := recover(); err != nil { // config.LogRecord.WithFields(logrus.Fields{"error": err}).Error("rpc worker error") // } //}() var transport thrift.TTransport newTransport, err := thrift.NewTBufferedTransportFactory(10).GetTransport(transport) if err != nil { panic("new transport error") } protocol := thrift.NewTBinaryProtocolFactoryDefault().GetProtocol(newTransport) orderProcessor := orderservice.NewOrderServiceProcessor(new(orderService)) OrderServiceName := "outgo" multiProcessor := thrift.NewTMultiplexedProcessor() multiProcessor.RegisterProcessor(OrderServiceName, orderProcessor) newTransport.Open() multiProcessor.Process(c, protocol, protocol) //newTransport.Close() } </code></pre> <p>golang err:</p> <pre><code> runtime error: invalid memory address or nil pointer dereference /usr/local/opt/go/libexec/src/runtime/panic.go:502 (0x102ad08) gopanic: reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz)) /usr/local/opt/go/libexec/src/runtime/panic.go:63 (0x1029d7d) panicmem: panic(memoryError) /usr/local/opt/go/libexec/src/runtime/signal_unix.go:388 (0x1040279) sigpanic: panicmem() /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/git.apache.org/thrift.git/lib/go/thrift/buffered_transport.go:58 (0x18c180a) (*TBufferedTransport).Open: return p.tp.Open() /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/app/http/controller/rpc/receiveBusiness.go:86 (0x18ce4cf) RpcReceive: newTransport.Open() /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/context.go:104 (0x1537b42) (*Context).Next: c.handlers[c.index](c) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/app/http/middleware/catchPanic.go:41 (0x16b2e20) RecoveryWithWriter.func1: c.Next() /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/context.go:104 (0x1537b42) (*Context).Next: c.handlers[c.index](c) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/app/http/middleware/commonMw.go:16 (0x16b40a4) Logger.func1: c.Next() /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/context.go:104 (0x1537b42) (*Context).Next: c.handlers[c.index](c) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/gin.go:332 (0x153ebe4) (*Engine).handleHTTPRequest: context.Next() /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/gin.go:296 (0x153e432) (*Engine).ServeHTTP: engine.handleHTTPRequest(c) /usr/local/opt/go/libexec/src/net/http/server.go:2694 (0x128093b) serverHandler.ServeHTTP: handler.ServeHTTP(rw, req) /usr/local/opt/go/libexec/src/net/http/server.go:1830 (0x127caf0) (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req) /usr/local/opt/go/libexec/src/runtime/asm_amd64.s:2361 (0x1057030) goexit: BYTE $0x90 // NOP ] &lt;nil&gt;} goroutine 33 [running]: net/http.(*conn).serve.func1(0xc4202da000) /usr/local/opt/go/libexec/src/net/http/server.go:1726 +0xd0 panic(0x1b06940, 0xc42033e5a0) /usr/local/opt/go/libexec/src/runtime/panic.go:502 +0x229 github.com/rule-engine/rule-engine/vendor/github.com/sirupsen/logrus.Entry.log(0xc4200d52c0, 0xc4202f4630, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/sirupsen/logrus/entry.go:126 +0x2d2 github.com/rule-engine/rule-engine/vendor/github.com/sirupsen/logrus.(*Entry).Panic(0xc42033e410, 0xc42056b640, 0x1, 0x1) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/sirupsen/logrus/entry.go:194 +0xaa github.com/rule-engine/rule-engine/vendor/github.com/sirupsen/logrus.(*Logger).Panic(0xc4200d52c0, 0xc42056b640, 0x1, 0x1) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/sirupsen/logrus/logger.go:244 +0x6d github.com/rule-engine/rule-engine/app/http/middleware.RecoveryWithWriter.func1.1(0xc42037e580) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/app/http/middleware/catchPanic.go:35 +0x46b panic(0x19db200, 0x21320b0) /usr/local/opt/go/libexec/src/runtime/panic.go:502 +0x229 github.com/rule-engine/rule-engine/vendor/git.apache.org/thrift.git/lib/go/thrift.(*TBufferedTransport).Open(0xc420248080, 0xc4202f4510, 0x1b241cf) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/git.apache.org/thrift.git/lib/go/thrift/buffered_transport.go:58 +0x2a github.com/rule-engine/rule-engine/app/http/controller/rpc.RpcReceive(0xc42037e580) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/app/http/controller/rpc/receiveBusiness.go:86 +0x370 github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin.(*Context).Next(0xc42037e580) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/context.go:104 +0x43 github.com/rule-engine/rule-engine/app/http/middleware.RecoveryWithWriter.func1(0xc42037e580) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/app/http/middleware/catchPanic.go:41 +0x51 github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin.(*Context).Next(0xc42037e580) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/context.go:104 +0x43 github.com/rule-engine/rule-engine/app/http/middleware.Logger.func1(0xc42037e580) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/app/http/middleware/commonMw.go:16 +0x85 github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin.(*Context).Next(0xc42037e580) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/context.go:104 +0x43 github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc4200dc6c0, 0xc42037e580) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/gin.go:332 +0x585 github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc4200dc6c0, 0x1c29ae0, 0xc42038c000, 0xc42015a000) /usr/local/var/www/go/src/github.com/rule-engine/rule-engine/vendor/github.com/gin-gonic/gin/gin.go:296 +0x153 net/http.serverHandler.ServeHTTP(0xc4200dc7e0, 0x1c29ae0, 0xc42038c000, 0xc42015a000) /usr/local/opt/go/libexec/src/net/http/server.go:2694 +0xbc net/http.(*conn).serve(0xc4202da000, 0x1c2a860, 0xc4201da4c0) /usr/local/opt/go/libexec/src/net/http/server.go:1830 +0x651 created by net/http.(*Server).Serve /usr/local/opt/go/libexec/src/net/http/server.go:2795 +0x27b </code></pre> <p>I refer php server to write golang server code.</p> </div>

Thrift问题:thrift --gen csharp demo.thrift执行后的文件出错

![图片说明](https://img-ask.csdn.net/upload/201807/25/1532499496_979041.png) 如上图, Apache Thrift问题 cmd 执行命令 :thrift --gen csharp demo.thrift 后的.cs文件报错 就以上两个 。 错误提示是:“TProtocol”不包含“IncrementRecursionDepth”的定义。 “TProtocol”不包含“DecrementRecursionDepth”的定义。 这个要怎么改?

如何在Thrift版本0.10.0的Go中从Thrift Server获取客户端IP?

<div class="post-text" itemprop="text"> <p>I'm writing a thrift service in Golang and I would like to understand how I can get the client's IP address in the handler functions implementation.</p> <p>I have tried it in Java, which can be obtained by overwrite TProcessor#process(in,out), but it seems that this way doesn't work in Golang.</p> <pre><code>serverTransport, err := thrift.NewTServerSocket(net.JoinHostPort(ip, strconv.FormatInt(port, 10))) //serverTransport, err := thrift.NewTServerSocket(net.JoinHostPort("127.0.0.1", "9999")) if err != nil { log.Error(err.Error()) os.Exit(1) } protocolFactory := thrift.NewTCompactProtocolFactory() transportFactory := thrift.NewTFramedTransportFactoryMaxLength(thrift.NewTTransportFactory(), 524288000) processor := iface.NewNMPDataServiceProcessor(new(impl.NMPDataService)) server := thrift.NewTSimpleServer4(processor, serverTransport, transportFactory, protocolFactory) server.Serve() defer server.Stop() </code></pre> <p>The Handler implementation of NMPDataService interface:</p> <pre><code>package impl import ( "NMPService/Framework/logger" "NMPService/NmpService/thrift/iface" "NMPService/NmpService/utils" "syscall" "errors" "fmt" "io" "io/ioutil" "os" "path/filepath" "regexp" "strconv" "strings" "time" "github.com/yeka/zip" ) var log = logger.GetBeeLogger() // NMPDataService . type NMPDataService struct { } const ( // MaxDownloadFileLimit ... MaxDownloadFileLimit int64 = 15728640 TempFolder string = "tmp" ) // ExistsFolder method // Parameters: // - Path func (handler *NMPDataService) ExistsFolder(path string) (bool, error) { log.Info("Check exist folder, path: %s", path) if strings.Contains(path, "\\") { path = strings.ReplaceAll(path, "\\", "/") } fileInfo, err := os.Stat(path) if os.IsNotExist(err) { log.Error("folder %s not exist", path) return false, nil } if !fileInfo.IsDir() { msg := "the path is not folder." log.Error(msg) return false, NewRPCException(1, msg, errors.New(msg)) } if err != nil { log.Error("Check exist folder error.") return false, NewRPCException(1, "Check exist folder error", err) } return true, nil } </code></pre> <p>Above is my code on Server side. I want to get client IP information from server.</p> </div>

求大神帮忙thrift是怎么传输文件的 求详细代码,在线等

如题,求使用thrift怎么传输文件,本人小白 求详细代码(thrift文件 服务端代码 客户端代码),在线等

您如何在Golang中使用Thrift的TMemoryBuffer?

<div class="post-text" itemprop="text"> <p>In Go, I have a byte array <code>data []byte</code> which I am trying to read into an object generated by Thrift. In C# the working code is as follows:</p> <pre><code>var request = new Request(); using (var transport = new TMemoryBuffer(data)) using (var protocol = new TBinaryProtocol(transport)) { request.Read(protocol); } </code></pre> <p>However in Go, it does not work:</p> <pre><code>request := app.NewRequest() transport := thrift.TMemoryBuffer{ Buffer: bytes.NewBuffer(data), } protocol := thrift.NewTBinaryProtocolTransport(transport) // error here request.Read(protocol) </code></pre> <p>The error it gives is:</p> <pre><code>cannot use memoryBuffer (type thrift.TMemoryBuffer) as type thrift.TTransport in argument to thrift.NewTBinaryProtocolTransport: thrift.TMemoryBuffer does not implement thrift.TTransport (Close method has pointer receiver) </code></pre> <p>I am unsure of how to fix this, as <code>TMemoryBuffer</code> does not seem to implement <code>TTransport</code> and I can't find documentation of how <code>TMemoryBuffer</code> should be used instead.</p> </div>

C++在windows平台下利用thrift通信

在windows下使用C++和Thrift开发客户端程序与HBase进行通信,总是实现不了。 已经安装了thrift所依赖的boost,libevent,openssl底层东西,也成功编译出了libthrift.lib和libthriftnb.lib两个lib库。 客户端程序添加引用如下: 1.在C++/常规/附加包含目录中添加对头文件的引用:C:\openssl\include;C:\libevent\include;C:\boost\include;E:\HBase\thrift-0.9.3\lib\cpp\src;E:\HBase\thrift-0.9.3\lib\cpp\src\thrift。 2.在链接器/常规/附加库目录中添加库文件目录:C:\openssl\out32dll;C:\libevent\libs;C:\boost\libs;E:\HBase\thrift-0.9.3\lib\cpp\Debug 3.在链接器/输入/附加依赖项中添加对libthrift.lib和libthriftnb.lib两个lib库的引用 但是在创建客户端引用的过程中总是报错: 错误 2 error LNK2019: 无法解析的外部符号 "public: void __thiscall apache::thrift::TOutput::perror(char const *,int)" (?perror@TOutput@thrift@apache@@QAEXPBDH@Z),该符号在函数 "protected: void __thiscall apache::thrift::transport::TSocket::openConnection(struct addrinfo *)" (?openConnection@TSocket@transport@thrift@apache@@IAEXPAUaddrinfo@@@Z) 中被引用 E:\HBase\thrift-0.9.3\lib\cpp\CppDemo\libthrift.lib(TSocket.obj) CppDemo 错误 3 error LNK2019: 无法解析的外部符号 "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl apache::thrift::TOutput::strerror_s(int)" (?strerror_s@TOutput@thrift@apache@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z),该符号在函数 "public: __thiscall apache::thrift::transport::TTransportException::TTransportException(enum apache::thrift::transport::TTransportException::TTransportExceptionType,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" (??0TTransportException@transport@thrift@apache@@QAE@W4TTransportExceptionType@0123@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) 中被引用 E:\HBase\thrift-0.9.3\lib\cpp\CppDemo\libthrift.lib(TSocket.obj) CppDemo 程序代码如下: #include "stdafx.h" #include<thrift/protocol/TProtocol.h> #include <thrift/transport/TSocket.h> #include <thrift/protocol/TBinaryProtocol.h> #include <thrift/server/TSimpleServer.h> #include <thrift/transport/TServerSocket.h> #include <thrift/transport/TBufferTransports.h> using namespace std; using namespace ::apache::thrift; using namespace ::apache::thrift::protocol; using namespace ::apache::thrift::transport; using namespace ::apache::thrift::server; using boost::shared_ptr; int _tmain(int argc, _TCHAR* argv[]) { boost::shared_ptr<TTransport> socket(new TSocket("127.0.0.1", 9090)); return 0; } 各位大神,可有办法?急...

如何在thrift中使用PHP和JAVA

<div class="post-text" itemprop="text"> <p>I have installed thrift 0.8.0 in Ubuntu 12.04<br> I followed the all commands correctly with out any error but after installation it's working perfect</p> <p><strong>Now i want to use PHP by using thrift but in below code it only Shows YES for C++ and Python i need java and PHP but that two languages shows NO How can i use PHP and java in thrift, is there any library for java and php ?</strong> </p> <pre><code>thrift 0.8.0 Building code generators ..... : Building C++ Library ......... : yes Building C (GLib) Library .... : no Building Java Library ........ : no Building C# Library .......... : no Building Python Library ...... : yes Building Ruby Library ........ : no Building Haskell Library ..... : no Building Perl Library ........ : no Building PHP Library ......... : no Building Erlang Library ...... : no Building Go Library .......... : no Building TZlibTransport ...... : yes Building TNonblockingServer .. : yes Using Python ................. : /usr/bin/python </code></pre> </div>

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

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

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

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

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

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

抖音上很火的时钟效果

反正,我的抖音没人看,别人都有几十万个赞什么的。 发到CSDN上来,大家交流下~ 主要用到原生态的 JS+CSS3。 具体不解释了,看注释: &lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;title&gt;Title&lt;/tit...

记录下入职中软一个月(外包华为)

我在年前从上一家公司离职,没想到过年期间疫情爆发,我也被困在家里,在家呆着的日子让人很焦躁,于是我疯狂的投简历,看面试题,希望可以进大公司去看看。 我也有幸面试了我觉得还挺大的公司的(虽然不是bat之类的大厂,但是作为一名二本计算机专业刚毕业的大学生bat那些大厂我连投简历的勇气都没有),最后选择了中软,我知道这是一家外包公司,待遇各方面甚至不如我的上一家公司,但是对我而言这可是外包华为,能...

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

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

手机经常收到"回复TD退订",回还是不回?今天总算是弄清楚了

自从有了微信和QQ,手机短信几乎很少再用了,但是我们手机里面还是经常会收到"回复TD退订"的消息,那到底要不要回复呢?今天就来告诉大家! 信息内容可能包括 推销信息 品牌活动日的时候,会根据你的用户浏览信息,或者购买记录,后续发送一些降价消息。 但是笔者想说我是缺那10块钱的人嘛,我缺的是1000块。 垃圾信息 虽然我们已经不经常用短信功能,但是还是有不少...

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

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

面试官问我:如何加载100M的图片却不撑爆内存

还记得当年面试一个面试官问我怎么加载巨图才能不撑爆内存,我没回答上来,他说分片显示,我寻思特么分片能减少内存使用??现在可以打他脸了! 内容扩展 1.图片的三级缓存中,图片加载到内存中,如果内存快爆了,会发生什么?怎么处理? 2.内存中如果加载一张 500*500 的 png 高清图片.应该是占用多少的内存? 3.Bitmap 如何处理大图,如一张 30M 的大图,如何预防 OOM? A...

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

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

又出事了?网站被攻击了?高中生?

北京时间2020年3月27日9点整,如往常一样来到公司,带开电脑,正准备打开Github网站看一会源代码,再开始手头的工作。哟吼,一直打不开,一直出现如下页面: 我想很多网友也尝到了甜头,各大技术群炸开了锅,据网友反馈有攻击者正在发起大规模的中间人挟持,京东和Github等网站等网站都受到了影响。 什么是中间中间人挟持呢? 简而言之,就是攻击者在数据网络传输的过程中,截获传输过程中的数据并篡改...

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

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

培训班出来的人后来都怎么样了?(二)

接着上回说,培训班学习生涯结束了。后面每天就是无休止的背面试题,不是没有头脑的背,培训公司还是有方法的,现在回想当时背的面试题好像都用上了,也被问到了。回头找找面试题,当时都是打印下来天天看,天天背。 不理解呢也要背,面试造飞机,上班拧螺丝。班里的同学开始四处投简历面试了,很快就有面试成功的,刚开始一个,然后越来越多。不知道是什么原因,尝到胜利果实的童鞋,不满足于自己通过的公司,嫌薪水要少了,选择...

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

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

6年开发经验女程序员,面试京东Java岗要求薪资28K

写在开头: 上周面试了一位女程序员,上午10::30来我们部门面试,2B哥接待了她.来看看她的简历: 个人简历 个人技能: ● 熟悉spring mvc 、spring、mybatis 等框架 ● 熟悉 redis 、rocketmq、dubbo、zookeeper、netty 、nginx、tomcat、mysql。 ● 阅读过juc 中的线程池、锁的源...

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

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

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

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

工作八年,月薪60K,裸辞两个月,投简历投到怀疑人生!

近日,有网友在某职场社交平台吐槽,自己裸辞两个月了,但是找工作却让自己的心态都要崩溃了,全部无果,不是已查看无回音,就是已查看不符合。 “工作八年,两年一跳,裸辞两个月了,之前月薪60K,最近找工作找的心态崩了!所有招聘工具都用了,全部无果,不是已查看无回音,就是已查看不符合。进头条,滴滴之类的大厂很难吗???!!!投简历投的开始怀疑人生了!希望 可以收到大厂offer” 先来看看网...

推荐9个能让你看一天的网站

分享的这9个保证另你意外的网站,每个都非常实用!非常干货!毫不客气的说,这些网站最少值10万块钱。 利用好这些网站,会让你各方面的技能都得到成长,不说让你走上人生巅峰,但对比现在的你,在眼界、学识、技能方面都有质的飞跃。 一、AIRPANO 传送门:https://www.airpano.com/360photo_list.php 这是一个可以躺在家里,就能环游世界的神奇网站。 世界那么大,绝大多...

大牛都会用的IDEA调试技巧!!!

导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

月薪22K程序员,打卡迟到10次,收到工资短信一脸懵逼

每家公司为了保证公司员工每天的工作时间,一般都会采用上下班打卡的工作制度,这其实是一个很常见的是,本身也没有什么问题的。正所谓无规矩不成方圆,公司肯定是有公司的规矩,虽然每个员工都很不喜欢这些规矩来束缚我们,但是公司也只是为了能更好的管理员工。但是一家公司如果一成不变的使用打卡制度,而不会去变通管理,也真不一定是好事。 打卡制度特别对于销售部门来说,不但会让公司发展不起来,还很容易丢失员工。但如...

97年世界黑客编程大赛冠军作品(大小仅为16KB),惊艳世界的编程巨作

这是世界编程大赛第一名作品(97年Mekka ’97 4K Intro比赛)汇编语言所写。 整个文件只有4095个字节, 大小仅仅为16KB! 不仅实现了3D动画的效果!还有一段震撼人心的背景音乐!!! 内容无法以言语形容,实在太强大! 下面是代码,具体操作看最后! @echo off more +1 %~s0|debug e100 33 f6 bf 0 20 b5 10 f3 a5...

不要再到处使用 === 了

我们知道现在的开发人员都使用 === 来代替 ==,为什么呢?我在网上看到的大多数教程都认为,要预测 JavaScript 强制转换是如何工作这太复杂了,因此建议总是使用===。这些都...

什么是a站、b站、c站、d站、e站、f站、g站、h站、i站、j站、k站、l站、m站、n站?00后的世界我不懂!

A站 AcFun弹幕视频网,简称“A站”,成立于2007年6月,取意于Anime Comic Fun,是中国大陆第一家弹幕视频网站。A站以视频为载体,逐步发展出基于原生内容二次创作的完整生态,拥有高质量互动弹幕,是中国弹幕文化的发源地;拥有大量超粘性的用户群体,产生输出了金坷垃、鬼畜全明星、我的滑板鞋、小苹果等大量网络流行文化,也是中国二次元文化的发源地。 B站 全称“哔哩哔哩(bilibili...

十个摸鱼,哦,不对,是炫酷(可以玩一整天)的网站!!!

文章目录前言正文**1、Kaspersky Cyberthreat real-time map****2、Finding Home****3、Silk – Interactive Generative Art****4、Liquid Particles 3D****5、WINDOWS93****6、Staggering Beauty****7、Ostagram图片生成器网址****8、全历史网址*...

我真的错了,我被跳槽后的高薪冲昏了头脑...

国内疫情已接近尾声,疫情对生活各个方面造成的影响,就是一场真实的“蝴蝶效应”。“全球最大安全套制造商因疫情停产,已造成一亿个安全套缺口”“口罩印钞机,月入千万的暴富神话”“百程旅行...

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

​能让德国人放弃现金支付​,也没谁了

在新冠疫情中,德国人越来越多地选择在超市,加油站或其他商店付款时使用非接触式付款方式。德国信贷协会Deutschen Kreditwirtschaft (DK) 的一位发言人告诉德国新...

相关热词 c# 局部 截图 页面 c#实现简单的文件管理器 c# where c# 取文件夹路径 c# 对比 当天 c# fir 滤波器 c# 和站 队列 c# txt 去空格 c#移除其他类事件 c# 自动截屏
立即提问