handler

FATAL EXCEPTION: Timer-0 java.lang.NullPointerException

∥☆過路亽.° 提交于 2019-12-24 18:38:45
问题 I'm having a timer in the oncreate() like: final Timer timer1 = new Timer(); timer1.schedule(new TimerTask() { public void run() { sendSMS(); } }, 20000); The methode sendSMS() is like: private void sendSMS(){ float test2; test2 = reallocation.getAccuracy(); //-> This is the line where logcat says.... NullPointerException .... } The logcat says: 05-30 18:32:26.962: W/dalvikvm(741): threadid=9: thread exiting with uncaught exception (group=0x4001d5a0) 05-30 18:32:26.972: E/AndroidRuntime(741):

使用carbondata DataMap过程中遇到的问题

对着背影说爱祢 提交于 2019-12-24 18:12:36
异常一、先创建datamap,在加载数据抛出以下异常 at java.lang.Thread.run(Thread.java:748) Caused by: java.util.concurrent.ExecutionException: org.apache.carbondata.processing.datamap.DataMapWriterException: java.io.IOException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.hdfs.protocol.AlreadyBeingCreatedException): Failed to CREATE_FILE /carbon/spark2.3.2/default/eve_not_partition_tbl_830f7cfd-16b6-4e30-b237-bbc74ea9e1d2/eve_not_partition_tbl_bloomfilter_dm/2/0_batchno0-0-2-1576672548810/src_ip.bloomindex for DFSClient_NONMAPREDUCE_193894307_1 on 10.10.151.15 because DFSClient_NONMAPREDUCE_193894307_1

Handler created in main thread acts like it is on another thread

你离开我真会死。 提交于 2019-12-24 14:09:11
问题 As google says: A Handler allows you to send and process Message and Runnable objects associated with a thread's MessageQueue. Each Handler instance is associated with a single thread and that thread's message queue. When you create a new Handler, it is bound to the thread / message queue of the thread that is creating it -- from that point on, it will deliver messages and runnables to that message queue and execute them as they come out of the message queue. And i expect when i create a

Android: AsyncTask, my 1st task has not finished when the other starts

元气小坏坏 提交于 2019-12-24 13:23:23
问题 Here's my code in my main thread myAsyncRunnable mar = new myAsyncRunnable(GameActivity.this); mar.execute("fire"); PhotoTask photoTask = new PhotoTask(camera,surfaceCamera,isPreview,holder,GameActivity.this); photoTask.execute(null); in myAsyncRunnable.fire() I have a loop that changes 10 times the image of an ImageView in gameActivity. I want the photoTask to start when the last image has been changed @Override protected Void doInBackground(String... params) { fire(); return null; } public

SpringMVC请求流程

不羁的心 提交于 2019-12-24 12:54:29
本文内容来自朱要光老师编著的《SpringMVC+MyBatis开发从入门到项目实战》书的第8章。 在学习SpringMVC框架之前,首先需要了解SpringMVC框架的整体请求流程和使用到的API流。SpringMVC的整体请求流程如下: 第一步: 用户单击某个请求路径,发起一个request请求,此请求会被前端控制器(DispatcherServlet)处理。 第二步: 前端控制器(DispatcherServlet)请求处理器映射器(HandlerMapping)去查找 Handler。可以依据注解或者XML配置去查找。 第三步: 处理器映射器(HandlerMapping)根据配置找到相应的 Handler(可以包含若干个 Interceptor 拦截器),返回给前端控制器(DispatcherServlet)。 第四步: 前端控制器(DispatcherServlet)请求处理器适配器(HandlerAdapter)去执行相应的 Handler(常称为Controller )。 第五步: 处理器适配器(HandlerAdapter)执行 Handler。 第六步: Handler 执行完毕后返回给处理器适配器(HandlerAdapter)一个 ModelAndView 对象(SpringMVC底层对象,包括 Model 数据模型和 View 视图信息)。 第七步:

Why this handler (runnable) is slowing down my app if it is launched on a service?

人走茶凉 提交于 2019-12-24 11:50:15
问题 i am using a background service that it is retrieving data and inserting data on a remote server. OK, i puted it on a background service because i wanted to get that done in background without slowing down my app, but it is slowing down my app ! as you will see in the code, it haves a sleep of 60 seconds, and my app is getting frozen 2/3 seconds each 60 seconds, it is this code, i am sure, but i dont know how to solve it public class MyService extends Service implements Runnable{ boolean

Netty学习总结(4)——图解Netty之Pipeline、channel、Context之间的数据流向

不羁岁月 提交于 2019-12-24 10:56:24
以下所绘制图形均基于Netty4.0.28版本。 一、connect(outbound类型事件) 当用户调用channel的connect时,会发起一个outbound类型的事件,该事件将在pipeline中传递(pipeline.connect),首先由tail handler处理,该handler只是将事件透传给下一个outbound类型的用户Handler(如果有),事件依次传递下去,直到传递到head handler,该handler会调用unsafe.connect向eventloop(nio的selector)注册一个读事件。 二、connect成功之后数据流图(inbound类型事件) 当用户发起一个connect请求后,当连接可用时,eventloop(底层使用nio的selector)会引发一个ChannelActive事件,该事件最先有unsafe捕获,之后会调用pipeline.fireChannelActive将该事件在pipeline中传播,紧接着会根据inbound类型事件的传递方式在各个handler和context之间进行链式传递。其中,有一个比较关注的地方是,在channelActive事件触发的时候,如果channel被设置成autoRead,那么此时还会调用channel.read方法,该方法并不是真正的从channel读取数据

11.Proxy

▼魔方 西西 提交于 2019-12-24 10:44:45
Proxy Proxy 概述 Proxy 用于修改某些操作的默认行为,等同于在语言层面做出修改,所以属于一种“元编程”(meta programming),即对编程语言进行编程。 Proxy 可以理解成,在目标对象之前架设一层“拦截”,外界对该对象的访问,都必须先通过这层拦截,因此提供了一种机制,可以对外界的访问进行过滤和改写。Proxy 这个词的原意是代理,用在这里表示由它来“代理”某些操作,可以译为“代理器”。 var obj = new Proxy({}, { get: function (target, key, receiver) { console.log(`getting ${key}!`); return Reflect.get(target, key, receiver); }, set: function (target, key, value, receiver) { console.log(`setting ${key}!`); return Reflect.set(target, key, value, receiver); } }); 上面代码对一个空对象架设了一层拦截,重定义了属性的读取( get )和设置( set )行为。这里暂时先不解释具体的语法,只看运行结果。对设置了拦截行为的对象 obj ,去读写它的属性,就会得到下面的结果。 obj

处理器拦截器(HandlerInterceptor)详解

雨燕双飞 提交于 2019-12-24 10:38:33
简介 SpringWebMVC的处理器拦截器,类似于Servlet开发中的过滤器Filter,用于处理器进行预处理和后处理。 应用场景 1、日志记录,可以记录请求信息的日志,以便进行信息监控、信息统计等。 2、权限检查:如登陆检测,进入处理器检测是否登陆,如果没有直接返回到登陆页面。 3、性能监控:典型的是慢日志。 HandlerInterceptor public interface HandlerInterceptor { /** * 预处理回调方法,实现处理器的预处理(如检查登陆),第三个参数为响应的处理器,自定义Controller * 返回值:true表示继续流程(如调用下一个拦截器或处理器);false表示流程中断(如登录检查失败),不会继续调用其他的拦截器或处理器,此时我们需要通过response来产生响应; */ boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception; /** * 后处理回调方法,实现处理器的后处理(但在渲染视图之前),此时我们可以通过modelAndView(模型和视图对象)对模型数据进行处理或对视图进行处理,modelAndView也可能为null。 */ void

Removing onchange event vis the dom

隐身守侯 提交于 2019-12-24 07:26:45
问题 I have the following html <td valign="top" nowrap="nowrap" align="left" rowspan="4"> <div id="win0divCLASS_SRCH_WRK2_SUBJECT$69$"> <input type="text" onchange="addchg_win0(this);oChange_win0=this;" maxlength="8" style="width:60px; " class="PSEDITBOX" value="" tabindex="31" id="CLASS_SRCH_WRK2_SUBJECT$69$" name="CLASS_SRCH_WRK2_SUBJECT$69$" /> </div></td> I'm trying to figure out how to either delete the onchange from the element, or to set it to null.. Articles I've seen indicate that using