同步问题+混淆器问题
有两个.java文件,如A.java 和 B.java
其中a.java的doPost方法部分如下:
public class A extends HttpServlet
{
public void doPost(HttpServletRequest httpservletrequest,HttpServletResponse httpservletresponse)
throws ServletException, IOException
{
synchronized(B.list)
{
B.list.add(runrecord);
if(B.threads < 1)
{
B.threads++;
B b = new B();
}
}
}
}
B.java的run方法代码如下:
public class B extends Thread
{
public B()
{
start();
}
public void run()
{
_$1537 = DBConfig.getConn();
_L2:
RunRecord runrecord;
try
{
label0:
{
synchronized(list)
{
if(!list.isEmpty())
break label0;
_$1537.close();
threads = threads <= 0 ? 0 : threads - 1;
}
return;
}
}
catch(Exception exception)
{
threads = threads <= 0 ? 0 : threads - 1;
exception.printStackTrace(System.err);
return;
}
runrecord = (RunRecord)list.get(0);
list.remove(0);
arraylist;
JVM INSTR monitorexit ;
goto _L1
exception1;
throw exception1;
_L1:
synchronized(C.c_mute)
{
if(Compile(runrecord, _$1537))
RunProcess(runrecord, _$1537);
}
goto _L2
}
public static ArrayList list = new ArrayList();
}
1.在A中用到了synchronized(B.list)而在其内又用到了 B b = new B(); 在B中又有synchronized(list) 这样怎么理解?
2.B的代码有混淆器的作用,应该怎么修改,特别是JVM INSTR monitorexit ;是不是就代表同步在那里结束的意思??
希望大侠多多指教
[解决办法]
UP
[解决办法]
这句话是用来判断什么的?
if(httpsession.getLastAccessedTime() + 100L > System.currentTimeMillis())
i++;
else
i=0;