Threading Issue

I am have written a test app in swing. The test app has two buttons and a progressbar. When I click the stop button, the stopButtonMouseClicked method is called, but the loop does not always terminate in the signalReader thread. Does anyone have any insight into this? A variable named "running" is set to true at the top of the loop, and is set to false when the stopButtonMouseClicked method is called.
The code that starts and stops my thread is:
private void buttonMouseClicked(MouseEvent evt){
signalReader = new SignalReader(dataLine, progressBar);
signalReader.startRecording();
private void stopButtonMouseClicked(MouseEvent evt){     
signalReader.stopRecording();
The class that extends Thread follows:
package swing;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.TargetDataLine;
import javax.swing.JProgressBar;
import javax.swing.SwingUtilities;
/** Data is moved from the target line to the output stream. */
class SignalReader extends Thread {
     public SignalReader(TargetDataLine dataLine, JProgressBar progressBar) {
          this.dataLine = dataLine;
          this.outputStream = new ByteArrayOutputStream();
          this.progressBar = progressBar;
          AudioFormat audioFormat = dataLine.getFormat();
          int bufferSize = (int) audioFormat.getSampleRate() * audioFormat.getFrameSize();
          buffer = new byte[ bufferSize ];
public void startRecording() {
// Start moving data.
     dataLine.start();
     super.start();
public void stopRecording() {
     // Stops data line I/O when the buffer is drained.
     dataLine.drain();
     // Free the resources the line has obtained.
     dataLine.close();
     running = false;
     try {
     outputStream.close();
     } catch ( IOException e ) {
     e.printStackTrace();
// Thread processing
public void run() {
running = true;
while ( running ) {
     // Move data from the target line (input)to the buffer (output).
     int bytesRead = dataLine.read( buffer, 0, buffer.length );
final int audioLevel = findAudioLevel(buffer);
progressBar.setValue(audioLevel);
System.out.println("Calculated audio level: " + audioLevel);
     if ( bytesRead >= 0 ){
     outputStream.write( buffer, 0, bytesRead );
public int findAudioLevel(byte theAudioData[])
//Do some audio calculations
// Fields
protected TargetDataLine dataLine;
protected ByteArrayOutputStream outputStream;
protected boolean running;
protected byte [] buffer;
static int WAV_HEADER_SIZE = 44;
protected JProgressBar progressBar;
}

The code that starts and stops my thread is:
private void buttonMouseClicked(MouseEvent evt){
signalReader = new SignalReader(dataLine, progressBar);
signalReader.startRecording();
private void stopButtonMouseClicked(MouseEvent evt){
signalReader.stopRecording();
}The class that extends Thread follows:
package swing;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.TargetDataLine;
import javax.swing.JProgressBar;
import javax.swing.SwingUtilities;
/** Data is moved from the target line to the output stream. */
class SignalReader extends Thread {
      public SignalReader(TargetDataLine dataLine, JProgressBar progressBar) {
            this.dataLine = dataLine;
            this.outputStream = new ByteArrayOutputStream();
            this.progressBar = progressBar;
            AudioFormat audioFormat = dataLine.getFormat();
            int bufferSize = (int) audioFormat.getSampleRate() * audioFormat.getFrameSize();
            buffer = new byte[ bufferSize ];
public void startRecording() {
  // Start moving data.
       dataLine.start();
       super.start();
public void stopRecording() {
       // Stops data line I/O when the buffer is drained.
       dataLine.drain();
       // Free the resources the line has obtained.
       dataLine.close();
       running = false;
       System.out.println("SignalReader - stopRecording!");
       try {
           outputStream.close();
       } catch ( IOException e ) {
           e.printStackTrace();
// Thread processing
public void run() {
  running = true;
  while ( running ) {
       // Move data from the target line (input)to the buffer (output).
       int bytesRead = dataLine.read( buffer, 0, buffer.length );
      final int audioLevel = findAudioLevel(buffer);
      progressBar.setValue(audioLevel);
      System.out.println("Calculated audio level: " + audioLevel);
       if ( bytesRead >= 0 ){
        outputStream.write( buffer, 0, bytesRead );
public int findAudioLevel(byte theAudioData[])
     int level = 1;
     //find audiolevel
     return level;
// Fields
protected TargetDataLine dataLine;
protected ByteArrayOutputStream outputStream;
protected boolean running;
protected byte [] buffer;
static int WAV_HEADER_SIZE = 44;
protected JProgressBar progressBar;
}

Similar Messages

  • Thread issue in jsp.....

    I understand that the j2ee container (tomcat or jrun...) creates ONE instance of the jsp page (i.e. compiled into servlet class) when the jsp page (let's say, myPage.jsp) is accessed the first time. All request for this jsp page will be done through thread.
    My questions are:
    1. If I instantiate an object (say, myObject) within the scriptlet, will the container create one instance of this object for each "jsp" thread? Or will there be only one instance of the myObject object and each "jsp" thread be running on a thread of myObject?!
    2. If I use javaBean in my jsp (i.e. use the <jsp:useBean..../> tag), I know that the container will create a new instance of the bean class. So if there are multiple request on the same jsp page, is it true that many instances of the bean will be created? And there will be no thread issue involed?!!
    Thanks!!

    When you create an instance of an object inside a scriplet using <% ... %>, that instance is local to the service) method of the servlet corresponding to the JSP. So there is no threading related issue.
    Smilar is the argument why there is not threading related issue with using <jsp:useBean>

  • Locked thread issue

    We encountered the following locked thread issue. Refer to the thread dump logs.
    Any idea on the root cause of the issue? It seens to us that it is the weblogic app server codes that are causing the locked threads.
    Will appreciate any advise.
    "ExecuteThread: '0' for queue: 'weblogic.socket.Muxer'" id=22 idx=0x50 tid=329 prio=5 alive, in native, blocked, daemon
    -- Blocked trying to get lock: java/lang/String@0x9a73910[fat lock]
    at jrockit/vm/Threads.waitForUnblockSignal()V(Native Method)
    at jrockit/vm/Locks.fatLockBlockOrSpin(Locks.java:1674)[optimized]
    at jrockit/vm/Locks.lockFat(Locks.java:1775)[optimized]
    at jrockit/vm/Locks.monitorEnterSecondStageHard(Locks.java:1311)[optimized]
    at jrockit/vm/Locks.monitorEnterSecondStage(Locks.java:1258)[optimized]
    at jrockit/vm/Locks.monitorEnter(Locks.java:2455)[optimized]
    at weblogic/socket/EPollSocketMuxer.processSockets(EPollSocketMuxer.java:153)
    at weblogic/socket/SocketReaderRequest.run(SocketReaderRequest.java:29)
    at weblogic/socket/SocketReaderRequest.execute(SocketReaderRequest.java:42)
    at weblogic/kernel/ExecuteThread.execute(ExecuteThread.java:145)
    at weblogic/kernel/ExecuteThread.run(ExecuteThread.java:117)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace
    "ExecuteThread: '2' for queue: 'weblogic.socket.Muxer'" id=24 idx=0x58 tid=331 prio=5 alive, in native, blocked, daemon
    -- Blocked trying to get lock: java/lang/String@0x9a73910[fat lock]
    at jrockit/vm/Threads.waitForUnblockSignal()V(Native Method)
    at jrockit/vm/Locks.fatLockBlockOrSpin(Locks.java:1674)[optimized]
    at jrockit/vm/Locks.lockFat(Locks.java:1775)[optimized]
    at jrockit/vm/Locks.monitorEnterSecondStageHard(Locks.java:1311)[optimized]
    at jrockit/vm/Locks.monitorEnterSecondStage(Locks.java:1258)[optimized]
    at jrockit/vm/Locks.monitorEnter(Locks.java:2455)[optimized]
    at weblogic/socket/EPollSocketMuxer.processSockets(EPollSocketMuxer.java:153)
    at weblogic/socket/SocketReaderRequest.run(SocketReaderRequest.java:29)
    at weblogic/socket/SocketReaderRequest.execute(SocketReaderRequest.java:42)
    at weblogic/kernel/ExecuteThread.execute(ExecuteThread.java:145)
    at weblogic/kernel/ExecuteThread.run(ExecuteThread.java:117)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace
    "ExecuteThread: '1' for queue: 'weblogic.socket.Muxer'" id=23 idx=0x54 tid=330 prio=5 alive, in native, daemon
    at jrockit/ext/epoll/EPoll.epollWait0(IIII)I(Native Method)
    at jrockit/ext/epoll/EPoll.epollWait(EPoll.java:103)
    at weblogic/socket/EPollSocketMuxer.processSockets(EPollSocketMuxer.java:156)
    ^-- Holding lock: java/lang/String@0x9a73910[fat lock]
    at weblogic/socket/SocketReaderRequest.run(SocketReaderRequest.java:29)
    at weblogic/socket/SocketReaderRequest.execute(SocketReaderRequest.java:42)
    at weblogic/kernel/ExecuteThread.execute(ExecuteThread.java:145)
    at weblogic/kernel/ExecuteThread.run(ExecuteThread.java:117)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

    This is standard behavior for the socket muxer threads. Only one of the epoll muxer threads is actually holding the lock at any one time. Here is the output of part of my thread dump on Linux with WLS 10.3.4 on JRockit on startup. The server is not hung up at all. Make a request on the server and take another thread dump and you'll see the lock change.
    1st dump with ExecuteThread 1 waiting to get the lock from ExecuteThread 2
    "ExecuteThread: '1' for queue: 'weblogic.socket.Muxer'" id=25 idx=0x58 tid=26836 prio=5 alive, blocked, native_blocked, daemon
        -- Blocked trying to get lock: java/lang/String@0xe82d6ec0[thin lock]
        at jrockit/vm/Threads.sleep(I)V(Native Method)
        at jrockit/vm/Locks.waitForThinRelease(Locks.java:955)
        at jrockit/vm/Locks.monitorEnterSecondStageHard(Locks.java:1083)
        at jrockit/vm/Locks.monitorEnterSecondStage(Locks.java:1005)
        at jrockit/vm/Locks.monitorEnter(Locks.java:2179)
        at weblogic/socket/EPollSocketMuxer.processSockets(EPollSocketMuxer.java:153)
        at weblogic/socket/SocketReaderRequest.run(SocketReaderRequest.java:29)
        at weblogic/socket/SocketReaderRequest.execute(SocketReaderRequest.java:42)
        at weblogic/kernel/ExecuteThread.execute(ExecuteThread.java:145)
        at weblogic/kernel/ExecuteThread.run(ExecuteThread.java:117)
        at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
        -- end of trace
    "ExecuteThread: '2' for queue: 'weblogic.socket.Muxer'" id=26 idx=0x5c tid=26837 prio=5 alive, in native, daemon
        at jrockit/ext/epoll/EPoll.epollWait0(ILjava/nio/ByteBuffer;II)I(Native Method)
        at jrockit/ext/epoll/EPoll.epollWait(EPoll.java:115)
        at weblogic/socket/EPollSocketMuxer.processSockets(EPollSocketMuxer.java:156)
        ^-- Holding lock: java/lang/String@0xe82d6ec0[thin lock]
        at weblogic/socket/SocketReaderRequest.run(SocketReaderRequest.java:29)
        at weblogic/socket/SocketReaderRequest.execute(SocketReaderRequest.java:42)
        at weblogic/kernel/ExecuteThread.execute(ExecuteThread.java:145)
        at weblogic/kernel/ExecuteThread.run(ExecuteThread.java:117)
        at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
        -- end of trace2nd dump after the server servers a request with ExecuteThread 2 waiting to get the lock from ExecuteThread 1
    "ExecuteThread: '1' for queue: 'weblogic.socket.Muxer'" id=25 idx=0x58 tid=26836 prio=5 alive, in native, daemon
        at jrockit/ext/epoll/EPoll.epollWait0(ILjava/nio/ByteBuffer;II)I(Native Method)
        at jrockit/ext/epoll/EPoll.epollWait(EPoll.java:115)
        at weblogic/socket/EPollSocketMuxer.processSockets(EPollSocketMuxer.java:156)
        ^-- Holding lock: java/lang/String@0xe82d6ec0[fat lock]
        at weblogic/socket/SocketReaderRequest.run(SocketReaderRequest.java:29)
        at weblogic/socket/SocketReaderRequest.execute(SocketReaderRequest.java:42)
        at weblogic/kernel/ExecuteThread.execute(ExecuteThread.java:145)
        at weblogic/kernel/ExecuteThread.run(ExecuteThread.java:117)
        at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
        -- end of trace
    "ExecuteThread: '2' for queue: 'weblogic.socket.Muxer'" id=26 idx=0x5c tid=26837 prio=5 alive, blocked, native_blocked, daemon
        -- Blocked trying to get lock: java/lang/String@0xe82d6ec0[fat lock]
        at jrockit/vm/Threads.waitForUnblockSignal()V(Native Method)
        at jrockit/vm/Locks.fatLockBlockOrSpin(Locks.java:1411)
        at jrockit/vm/Locks.lockFat(Locks.java:1512)
        at jrockit/vm/Locks.monitorEnterSecondStageHard(Locks.java:1054)
        at jrockit/vm/Locks.monitorEnterSecondStage(Locks.java:1005)
        at jrockit/vm/Locks.monitorEnter(Locks.java:2179)
        at weblogic/socket/EPollSocketMuxer.processSockets(EPollSocketMuxer.java:153)
        at weblogic/socket/SocketReaderRequest.run(SocketReaderRequest.java:29)
        at weblogic/socket/SocketReaderRequest.execute(SocketReaderRequest.java:42)
        at weblogic/kernel/ExecuteThread.execute(ExecuteThread.java:145)
        at weblogic/kernel/ExecuteThread.run(ExecuteThread.java:117)
        at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
        -- end of traceHere is a blog on this topic: http://jojovedder.blogspot.com/2009/05/weblogic-socket-muxers-are-not-stuck.html

  • Problem Deploying Composites to Oracle SOA 11.1.1.5 (STUCK Thread Issue)

    Hi All,
    I got stuck thread issues when deploying composites to Oracle SOA 11.1.1.5 running on Windows Server 2008 R2. Even the SimpleApproval composite which ships with the standard installation is having trouble deploying.
    The composites are deploying fine in Oracle SOA 11.1.1.5 running on Windows XP.
    I'm not so good with thread dumps, so I post it below for rescue.
    Please advice,
    Rommel
    <Jul 18, 2011 10:15:25 AM AST> <Error> <WebLogicServer> <BEA-000337> <[STUCK] Ex
    ecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)' has been bus
    y for "605" seconds working on the request "weblogic.servlet.internal.ServletReq
    uestImpl@32d047d4[
    POST /soa-infra/deployer HTTP/1.1
    Connection: TE
    TE: trailers, deflate, gzip, compress
    User-Agent: Oracle HTTPClient Version 10h
    Accept-Encoding: gzip, x-gzip, compress, x-compress
    ECID-Context:
    Authorization: Basic bmFnaGl3ZWJsb2dpY3NvYTp3ZWJsb2dpY3NvYTEwIQ==
    Content-type: application/octet-stream
    Content-Length: 25876
    ]", which is more than the configured time (StuckThreadMaxTime) of "600" seconds
    . Stack trace:
    Thread-55 "[STUCK] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-
    tuning)'" <alive, in native, suspended, priority=1, DAEMON> {
    jrockit.net.SocketNativeIO.readBytesPinned(SocketNativeIO.java:???)
    jrockit.net.SocketNativeIO.socketRead(SocketNativeIO.java:24)
    java.net.SocketInputStream.socketRead0(SocketInputStream.java:???)
    java.net.SocketInputStream.read(SocketInputStream.java:107)
    oracle.net.nt.MetricsEnabledInputStream.read(TcpNTAdapter.java:707)
    oracle.net.ns.Packet.receive(Packet.java:243)
    oracle.net.ns.DataPacket.receive(DataPacket.java:106)
    oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:309)
    oracle.net.ns.NetInputStream.read(NetInputStream.java:254)
    oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrap
    per.java:93)
    oracle.jdbc.driver.T4CMAREngine.getNBytes(T4CMAREngine.java:1573)
    oracle.jdbc.driver.T4C8TTILobd.unmarshalLobData(T4C8TTILobd.java:360)
    oracle.jdbc.driver.T4C8TTILob.readLOBD(T4C8TTILob.java:787)
    oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:303)
    oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:181)
    oracle.jdbc.driver.T4C8TTILob.read(T4C8TTILob.java:139)
    oracle.jdbc.driver.T4CConnection.getBytes(T4CConnection.java:2690)
    ^-- Holding lock: oracle.jdbc.driver.T4CConnection@32386377[thin lock]
    oracle.sql.BLOB.getBytes(BLOB.java:557)
    oracle.jdbc.driver.OracleBlobInputStream.needBytes(OracleBlobInputStream.jav
    a:188)
    oracle.jdbc.driver.OracleBufferedStream.readInternal(OracleBufferedStream.ja
    va:171)
    oracle.jdbc.driver.OracleBufferedStream.read(OracleBufferedStream.java:151)
    ^-- Holding lock: oracle.jdbc.driver.OracleBlobInputStream@341d0b87[thin loc
    k]
    java.io.BufferedInputStream.fill(BufferedInputStream.java:189)
    java.io.BufferedInputStream.read(BufferedInputStream.java:236)
    ^-- Holding lock: oracle.mds.internal.persistence.db.DBInputStream@341d0bb2[
    thin lock]
    oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:363)
    oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:230)
    oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:217)
    oracle.fabric.common.wsdl.SchemaBuilder.parseXMLSrc(SchemaBuilder.java:1016)
    oracle.fabric.common.wsdl.SchemaBuilder.parseXSDSrc(SchemaBuilder.java:984)
    oracle.fabric.common.wsdl.SchemaBuilder.processSchemaImportsAndInclude(Schem
    aBuilder.java:755)
    oracle.fabric.common.wsdl.SchemaBuilder.loadEmbeddedSchemas(SchemaBuilder.ja
    va:474)
    oracle.fabric.common.wsdl.SchemaBuilder.loadSchemasFromWSDL(SchemaBuilder.ja
    va:423)
    oracle.fabric.common.wsdl.SchemaBuilder.loadAllSchemas(SchemaBuilder.java:21
    4)
    oracle.fabric.common.wsdl.SchemaManager.loadAllXSD(SchemaManager.java:209)
    ^-- Holding lock: oracle.fabric.common.wsdl.SchemaManager@36279195[thin lock
    oracle.fabric.common.wsdl.SchemaManager.getXSDEntityResolver(SchemaManager.j
    ava:424)
    oracle.fabric.composite.model.CompositeModel.loadImports(CompositeModel.java
    :361)
    oracle.fabric.composite.model.CompositeModel.getWSDLManager(CompositeModel.j
    ava:196)
    oracle.integration.platform.blocks.adapter.AbstractAdapterBindingComponent.g
    etWSDLDefinition(AbstractAdapterBindingComponent.java:168)
    oracle.integration.platform.blocks.adapter.AdapterReference.loadDefinition(A
    dapterReference.java:543)
    oracle.integration.platform.blocks.adapter.AdapterReference.load(AdapterRefe
    rence.java:377)
    oracle.integration.platform.blocks.adapter.AdapterReference.load(AdapterRefe
    rence.java:73)
    oracle.integration.platform.blocks.deploy.CompositeDeploymentConnection.depl
    oyReferences(CompositeDeploymentConnection.java:177)
    oracle.integration.platform.blocks.deploy.CompositeDeploymentConnection.depl
    oy(CompositeDeploymentConnection.java:81)
    oracle.integration.platform.blocks.deploy.CompositeDeploymentManagerImpl.ini
    tDeployment(CompositeDeploymentManagerImpl.java:143)
    oracle.integration.platform.blocks.deploy.CompositeDeploymentManagerImpl.loa
    d(CompositeDeploymentManagerImpl.java:61)
    sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:?
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:27
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
    java.lang.reflect.Method.invoke(Method.java:575)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopU
    tils.java:306)
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint
    (ReflectiveMethodInvocation.java:182)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflect
    iveMethodInvocation.java:148)
    oracle.integration.platform.blocks.deploy.DeploymentEventPublisher.invoke(De
    ploymentEventPublisher.java:57)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflect
    iveMethodInvocation.java:148)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopPro
    xy.java:151)
    $Proxy309.load(Unknown Source)
    oracle.integration.platform.blocks.deploy.StandaloneCompositeDeploymentCoord
    inatorImpl.coordinateCompositeDeployment(StandaloneCompositeDeploymentCoordinato
    rImpl.java:54)
    oracle.integration.platform.blocks.deploy.servlet.BaseDeployProcessor.deploy
    NewComposite(BaseDeployProcessor.java:365)
    oracle.integration.platform.blocks.deploy.servlet.BaseDeployProcessor.deploy
    SARs(BaseDeployProcessor.java:123)
    ^-- Holding lock: java.lang.Object@3621c97c[thin lock]
    oracle.integration.platform.blocks.deploy.servlet.DeployProcessor.doDeployWo
    rk(DeployProcessor.java:122)
    oracle.integration.platform.blocks.deploy.servlet.DeployProcessor.doDeployWo
    rk(DeployProcessor.java:107)
    oracle.integration.platform.blocks.deploy.servlet.DeployProcessor.doDeploy(D
    eployProcessor.java:96)
    oracle.integration.platform.blocks.deploy.servlet.DeployProcessor.process(De
    ployProcessor.java:68)
    oracle.integration.platform.blocks.deploy.servlet.CompositeDeployerServlet.d
    oPostInsideLoggingSession(CompositeDeployerServlet.java:141)
    oracle.integration.platform.blocks.deploy.servlet.CompositeDeployerServlet.d
    oPost(CompositeDeployerServlet.java:119)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:700)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:815)
    weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSe
    curityHelper.java:224)
    weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelpe
    r.java:108)
    weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:206)
    weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:55)
    oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
    oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:299)
    oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java
    :405)
    oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
    oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:98)
    oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
    weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:55)
    oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
    oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:299)
    oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java
    :405)
    oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
    oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:98)
    oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
    weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:55)
    oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:86)
    weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:55)
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapR
    un(WebAppServletContext.java:3687)
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
    ebAppServletContext.java:3681)
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
    t.java:308)
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:116)
    weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletC
    ontext.java:2213)
    weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.
    java:2135)
    weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:142
    0)
    weblogic.work.ExecuteThread.execute(ExecuteThread.java:203)
    weblogic.work.ExecuteThread.run(ExecuteThread.java:170)
    >

    I just noted that this is a database connectivity issue because when I point my soa related data sources (mds, soa_infra, etc...)to a local xe database, the deployment is doing fine.

  • Need help about Thread issue

    Given from scjp
    1.public static void main(String[] args) {
    2.        NameRunnable nr = new NameRunnable();
    3.        Thread t1 = new Thread(nr);              
    4.        t1.start();
    5.        t1.join();                   
    }There are some questions which i made up myself to test how i understand about the thread issue and I really need some experts to confirm about it.
    Question 1: At line 3, how many threads we have now ?
    my answer is
    there are 2 threads. the first one is main thread and the second one is t.
    I am not sure about the t thread because in the book, they indicate that after instantiating the thread,
    we just have a thread object but not a true thread.
    Question 2: At line 4, after t1.start(), which thread will be executed first.
    My answer is
    we dont know because it depends on the scheduler.
    Question 3: what t1.join() does ?
    my answer is
    blablabla.What I am thinking is t.join() joins the current thread to the end of t so that when t finishes the current thread can run again. However, which one is the current thread now. That is why I am stuck
    Please help me. I appreciate
    Edited by: newbie on Nov 25, 2010 4:46 PM
    Edited by: newbie on Nov 25, 2010 4:47 PM
    Edited by: newbie on Nov 25, 2010 4:49 PM

    newbie wrote:
    Given from scjp
    public static void main(String[] args) {
    NameRunnable nr = new NameRunnable();
    Thread t1 = new Thread(nr);              
    t1.start();
    t1.join();                   
    }There are some questions which i made up myself to test how i understand about the thread issue and I really need some experts to confirm about it.
    Question 1: At line 3, how many threads we have now ?
    my answer is
    there are 2 threads. the first one is main thread and the second one is t.
    I am not sure about the t thread because in the book, they indicate that after instantiating the thread,
    we just have a thread object but not a true thread.
    Don't use code blocks for prose. It won't autowrap and can lead to display problems if a line is too long.
    Which is line 3?
    What do you mean by "how many threads to we have?" Do you mean how many Thread objects exist, or how many threads (lower case "t") are executing.
    After you have called t1.start(), there are at least 2 threads executing--the main thread, and the one you started. I say "at least" because the JVM has some administrative threads of its own.
    Question 2: At line 4, after t1.start(), which thread will be execute first.
    My answer is
    we dont know because it depends on the scheduler.
    Correct. And don't think of one executing "first." They can take turns, or they can both execute at the same time (if you have a multicore or multi-CPU machine).
    Question 3: what t1.join() does ?
    my answer is
    blablabla.What I am thinking is t.join() joins the current thread to the end of t so that when t finishes the current thread can run again. However, which one is the current thread now. That is why I am stuck
    Please help me. I appreciateDid you read [url http://download.oracle.com/javase/6/docs/api/java/lang/Thread.html#join()]the docs for join()? They tell you exactly what it does. If you don't understand after reading, post again.

  • JMeter +JSF 1.2 +Multiple threads issue

    I have an issue when running JMeter with an JSF 1.2 application.
    I have the regex and xpath fix working. It is extracting the correct ViewState value, but only as long as I am running one thread. If I start a thread group with multiple threads the regex/xpath will eventually return the default value and the test will fail.
    Scenario 1 (SUCCESS):
    I run one thread and one thread group, regex/xpath return the
    "ViewState" value correctly and the test runs perfectly until I stop it.
    Scenario 2 (FAILURE):
    I run multiple threads and one thread group, regex/xpath
    eventually return the DEFAULT value instead the "ViewState" value to
    all but one thread. The more threads the faster they fail. It really
    seems like there is a threading issue.
    Has anyone experienced similar issues when running regex/xpath and multiple threads?

    Thank you, I tried what you suggested and revealed something interesting. The application in some cases prints the following on the screen:
    *~com.sun.faces.saveStateFieldMarker~*, and it is in those cases JMETER Xpath extraction fails.
    Well I have to look more into it. Thank again for the help.

  • Thread issue...please clarify

    I am kind of new in Servlet/JSP world.
    I have a servlet and it gets the information from the database and put the information in a bean . In the servlet, the bean is placed in session object. The code is as follows:
    doPost(......)
    HttpSession session = req.getSession(true);
    //Here session is local variable to doPost()
    session.setAttribute("name", databean);
    //databean is the bean created by servlet inside doPost()
    //Then sendRedirect to a JSP page to show the information from the bean.
    The JSP retrives the values as bellow:
    <jsp:useBean id="name" class="common.Databean"
         scope="session" />
    <%
              //Get the information from the bean               
              Rowbean [] rows = name.getRows();
              for(int x = 0; x < rows.length ; x++)
              String description = rows[x].getDescription();
              String category_ident = rows[x].getCategory_ident();
    %>
    My question is :
    Is there any safe threading issue in this procedure..to be specific is that session object is accessable by any other client calling same time the servlet..
    Any explanation will be appreciated.
    Shakilc

    It is quite possible that the session can be accessed by two threads. This would be the case if the user accesses your servlet from two browser windows (or tabs). Browsers have different behaviors with regard to interacting with your application sessions. For example, two IE windows will be treated as two sessions, whereas, two Netscape tabs (not windows) will be treated as a single session. This behavior is browser specific. So, it is quite likely that you may be have two threads accessing your session at the same time. The session implementation is typically synchronized, so that two or more threads cannot modify a session value at the same time, but, one thread can immediately overwrite a value stored by another thread. This is normal behavior and typically acceptable behavior.
    Hope this answers your question.
    Sonny

  • Deadlock with thread issues while generating reports with Crystal Report XI

    We are facing deadlock with thread issues while generating report with Crystal Report XI
    Version Number is 11.0 and the database used is Oracle
    In the log file on line number 74350  by 2008/12/16 13:35:54 there is a dead lock with Thread: u20184u2019 is waiting to acquire lock for 'com.crystaldecisions.reports.queryengine.av@15214b9' which is held by the Thread: '0'.
    And  a dead lock with Thread: u20180u2019 is waiting to acquire lock for 'com.crystaldecisions.reports.queryengine.av@15214b9' which is held by the Thread: '4'.
    Exactly after 10 minutes we can see the thread 4 and 0 are declared as STUCK by 2008/12/16  13:45:54 .
    Is this an existing issue with Crystal Report?
    Is there some solution for this problem?
    THE LOG FILE INFORMATION IS GIVEN BELOW
    [deadlocked thread] [ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)':
    Thread '[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'' is waiting to acquire lock 'com.crystaldecisions.reports.queryengine.av@15214b9' that is held by thread '[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)''
    Stack trace:
         com.crystaldecisions.reports.queryengine.av.V(Unknown Source)
         com.crystaldecisions.reports.queryengine.av.do(Unknown Source)
         com.crystaldecisions.reports.queryengine.as.if(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.datainterface.j.c(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.cy.b(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.cy.long(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.a1.o(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.a1.a(Unknown Source)
         com.crystaldecisions.reports.common.ab.a(Unknown Source)
         com.crystaldecisions.reports.common.ab.if(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.a1.if(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.a1.o(Unknown Source)
         com.crystaldecisions.reports.reportengineinterface.a.a(Unknown Source)
         com.crystaldecisions.reports.reportengineinterface.a.a.b.a(Unknown Source)
         com.crystaldecisions.reports.sdk.ReportClientDocument.open(Unknown Source)
         com.sysarris.aris.crystalreports.RepServlet.generateReport(RepServlet.java:65)
         com.sysarris.aris.crystalreports.RepServlet.doPost(RepServlet.java:40)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
         weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
         weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
         weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
         weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3153)
         weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1973)
         weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
         weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
         weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
         weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
    [deadlocked thread] [ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)':
    Thread '[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'' is waiting to acquire lock 'com.crystaldecisions.reports.queryengine.av@12e0415' that is held by thread '[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)''
    Stack trace:
         com.crystaldecisions.reports.queryengine.av.V(Unknown Source)
         com.crystaldecisions.reports.queryengine.av.do(Unknown Source)
         com.crystaldecisions.reports.queryengine.as.if(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.datainterface.j.c(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.cy.b(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.cy.long(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.a1.o(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.a1.a(Unknown Source)
         com.crystaldecisions.reports.common.ab.a(Unknown Source)
         com.crystaldecisions.reports.common.ab.if(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.a1.if(Unknown Source)
         com.crystaldecisions.reports.reportdefinition.a1.o(Unknown Source)
         com.crystaldecisions.reports.reportengineinterface.a.a(Unknown Source)
         com.crystaldecisions.reports.reportengineinterface.a.a.b.a(Unknown Source)
         com.crystaldecisions.reports.sdk.ReportClientDocument.open(Unknown Source)
         com.sysarris.aris.crystalreports.RepServlet.generateReport(RepServlet.java:65)
         com.sysarris.aris.crystalreports.RepServlet.doPost(RepServlet.java:40)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
         weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
         weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
         weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
         weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3153)
         weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1973)
         weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
         weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
         weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
         weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
    Can you please suggest any work around for this?

    I'm not referring to Servlet threading issues.
    I'll clarify.
    You have two threads, both entering ReportClientDocument.open(...) method.
    Thread 4 is waiting to acquire 'com.crystaldecisions.reports.queryengine.av@15214b9'
    Thread 0 is waiting to acquire ''com.crystaldecisions.reports.queryengine.av@12e0415'
    So I'm thinking ??? are they the same objects?
    My specific question concerning the ReportClientDocument is that both are calling open - i.e., trying to open a new report.  You wouldn't be trying to open different reports using the same ReportClientDocument - so was wondering if you've cached the RCD and trying to open two different reports at the same time on the same instance via different threads.
    You'd normally tie a ReportClientDocument instance to a HTTP Session, to ensure each user gets their own copy.
    Sincerely,
    Ted Ueda

  • JPS thread issues and Tag Libs

    I was curious as to the thread issues with using Tag Libs inside of JPS'.
    I realize that many threads can access an individual JSP and that a JSP (at least in tomcat) uses the same instance of its tag over and over again.
    But I have the following questions:
    Are there thread race issues with using tags?
    If there are thread race issues wouldn't it be a bad idea to use the setter methods on a tag or have any instance level variables in a tag?
    Is the access to the tag synchronized in the creation of the JSP/Servlet?
    Thanks for your time,
    Nate

    I actually decompiled the JSP that was created by tomcat and it (the complied JSP) is actually using a factory to get an instance of a tag. When the complied JSP is done with the Tag instance it calls the release() method on the Tag and then the factory is allowed to reuse that Tag.
    So, basically when Tags are used like they are supposed to be, there are no threading/race issues.
    I have downloaded the Tag specs, but haven't been able to read them yet. After I do get the chance to read them, I will try and post my findings.

  • Memory leaks and multi threading issues in managed client.

    In our company we use a lot of Oracle, and after the release of the managed provider we migrated all applications to it. First the  things were very impressive : the new client was faster, but after some days applications that uses 100MB with old client goes to 1GB and up. The memory is not the only issue, we use a lot of multi threading, and we experience connection drops and not disposal, after 1 days working one of the application had over 100 sessions on the server. I think there is something wrong with connection pool and multi threading.
    Is someone experience same problems.
    Yesterday we went back with unmanaged provider. Now things are back to normal.

    connection drops: did you try to use "Validate Connection=true" parameter in your connection string?
    the new client was faster: are you sure with this statement? Even in 64bit environment? I got quite serious performance problems when running application under 64bit process: https://forums.oracle.com/thread/2595323

  • Hi Guys! Will you share your thoughts on a Thread issue?

    Hi! I am working on figuring out how to get my application to use threads to enable the simultaneous movement of (n) balls across the JFrame area. The task is to enable the user to click on the application and with each click a new ball should be created as a Thread and then it should bounce back and forth across the screen.
    I have been working on this now for a couple of days. It would be really great if one of you guys could help me! :-)
    Here are my specific issues:
    I am using the mousePressed() method to generate the data needed to instantiate a Ball object. However, I cannot get it to work as a Thread.
    I tried calling the start() method on it but all that happens is the application stays blank.
    I cannot get this thing to work -and I really need to make it work today -- Please --- is there a sweetheart out there who will take a minute to help? ;-)
    Jennifer
    My code is below:
    Balls.java
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Balls extends JFrame implements MouseListener
          private int x, y, r, g, b;//Variables to hold x,y and color values
          private Vector basketOBalls;//Hold all of the Ball objects (and Threads created)
          private Ball ballFactory;//Ball objects created here
            Method Name: Balls()
            Return Value: none
            Input Parameters: None
            Method Description: Constructor
          public Balls()
            //call to super for Title of app
            super( " Bouncing Balls " );
            //Listen for mouse events
            addMouseListener( this ); 
            //instantiate the basketOBalls object
            basketOBalls = new Vector(20);
                //Set Initial JFrame Window Size
            setSize( 400, 400 );
         //Show it!
         show();
         }//EOConstructor
            Method Name: mousePressed(MouseEvent e)
            Return Value: none
            Input Parameters: MouseEvent
            Method Description: This takes the info from the users
            mouse click and creates a new Ball Object and then adds it
            to the basketOBalls Vector. Presently, it (incorrectly?) also
            calls the repaint() method in order to draw the ball to the
            screen.
           public void mousePressed( MouseEvent e )
               x = e.getX();//set x value
               y = e.getY();//set y value
               r = 1 + (int) ( 254 * Math.random() );//set red value
               g = 1 + (int) ( 254 * Math.random() );//set green value
               b = 1 + (int) ( 254 * Math.random() );//set blue value
               Color colorin = new Color( r, g, b );
               ballFactory = new Ball( x, y, colorin );
               //new Thread(ballFactory).start(); //This is the Problem area!!!!!!!!!!!!!!!!!!!!!
               basketOBalls.addElement( ballFactory );
               repaint();
            }//EOmP
            Method Name: paint( Graphics g )
            Return Value: none
            Input Parameters: Graphics Object g
            Method Description: Walk through the Vector to
            explicitly cast each object back as a Ball and
            then calls the Ball draw() and ball move() methods
            in order to make the balls move on the screen.
        public void paint( Graphics g )
            Ball b;
            for( int i = 0; i < basketOBalls.size(); i++)
               b = (Ball) (basketOBalls.elementAt(i));
               b.draw(g);
               b.move();
            }//EOFor
          }//EOpaint
            Method Name: main()
            Return Value: none
            Input Parameters: String args[]
            Method Description: This makes it all go.
          public static void main( String args[] )
            Balls app = new Balls();
            app.addWindowListener(
              new WindowAdapter()
                     public void windowClosing( WindowEvent e )
                                    System.exit(0);
                     }//EOwindowClosing Method
              }//EOWindowAdapter Method
              );//EOaddWindowListener Argument
          }//EOMain
        public void mouseClicked( MouseEvent e ) { }
        public void mouseReleased( MouseEvent e ) { }
        public void mouseEntered( MouseEvent e ) { }
        public void mouseExited( MouseEvent e ) { }
    }//EOFBall.java
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Ball extends JFrame //implements Runnable
            public static final int APP_SIZE = 400;//set bounds for screen area
         public static final int RADIUS = 15;//set size of balls
            private Color bgColor = java.awt.Color.lightGray;//may be used to clear background of JFrame
         private int x, y;//x & y coordinates
         private int speedX, speedY;//distances to use to redraw the balls
            private Color color = null;//the color of a ball
            Method Name: Ball(int initX, int initY, Color colorin) 
            Return Value: none
            Input Parameters: int, int , color
            Method Description: Constructor that creates a Ball object
         public Ball(int initX, int initY, Color colorin)
              x = initX;
              y = initY;
                    color = colorin;
                 speedX = (int)(1 + (Math.random() * 10));
              speedY = (int)(1 + (Math.random() * 10));
            Method Name: move()
            Return Value: none
            Input Parameters: none
            Method Description: This calculates the balls position and keeps it within
            the 400 pixel size of the application frame.
         public void move()
              x += speedX;
              y += speedY;
              if ((x - RADIUS < 0) || (x + RADIUS > APP_SIZE))
                   speedX = -speedX;
                   x += speedX;
              if ((y - RADIUS < 0) || (y + RADIUS > APP_SIZE))
                   speedY = -speedY;
                   y += speedY;
         } //EOMove
            Method Name: draw(Graphics bg) 
            Return Value: none
            Input Parameters: graphics
            Method Description: This method is how the ball draws itself
            public void draw(Graphics bg)
                bg.setColor( color );
                bg.fillOval(x - RADIUS, y - RADIUS, 2 * RADIUS, 2 * RADIUS);
    //PROBLEM AREA PROBLEM AREA PROBLEM AREA PROBLEM AREA PROBLEM AREA PROBLEM AREA
            Method Name: run() 
            Return Value: none
            Input Parameters: none
            Method Description: This method is called by start() in the Balls.java file
            found in the mousePressed() method. however, it does not work properly.
         public void run()
               while(true)
              try
                 Thread.sleep(100);
                       move();
                       draw(g);
                       repaint();
                    catch(Exception e)
                    e.printStackTrace( System.out );
        }//EOF

    There needs to be only one thread. On every mouse pressed just add a new Ball object to the vector located in Balls class. That thread need only invoke a repaint on your main class called Balls.
    public class Balls extends JFrame implements Runnable,MouseListener{
    Vector vector = new Vector();
    public static void main(String[] args){
    Balls balls = new Balls(); balls.setSize(400,400);
    balls.setVisible(true);
    Thread thread = new Thread(this);
    thread.start();
    public void run(){ 
    while(true){
    repaint();
    try{
    Thread.sleep(4000); //delay
    }catch(InterruptedException e){}
    public void paint(Graphics){
    for(i=0; i<vector.size(); i++){
    Ball b = (Ball)vector.elementAt(i);
    reposition(b);
    g.drawArc(b.getX(),b.getY(),0,360);
    public void reposition(Ball b){
    // reposition ball using balls get/set methods.
    public void MouseClicked(MouseEvent e){
    // add a new ball to vector.
    public class Ball{
    int x,y;
    public int getX(){ return x; }
    public int getY(){ return y; }
    public int setX(int x){ this.x = x; }
    public int setY(int y){ this.y = y; }
    Do check the syntax and compilation errors. The code above should give you some idea for approach.

  • Thread issue when delete socket

    I've got a new problem: when I try to close the socket by deleting it, a thread marshalling issue has appeared:
    void MainPage::PutOutFire()
    if (CoreApplication::Properties->HasKey("client"))
    // Remove the socket from the list of application properties as we are about to close it.
    StreamSocket^ socket = dynamic_cast<StreamSocket^>(CoreApplication::Properties->Lookup("client"));
    CoreApplication::Properties->Remove("client");
    // Close the socket.
    Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler([this, &socket]()
    if (socket)
    delete socket;//pivot of crash!!!
    socket = nullptr;
    bIsConnected = false;
    NotifyUser("Client closed.", NotifyType::StatusMessage);
    else
    NotifyUser("Client already closed or not connected.", NotifyType::WarningMessage);
    This is called by the button event handler.
    Then I get this error:
    Microsoft C++ exception: Platform::WrongThreadException ^ at memory location 0x0545DD48. HRESULT:0x8001010E The application called an interface that was marshalled for a different thread.
    WinRT information: The application called an interface that was marshalled for a different thread.
    I used the Dispatcher, and I put it in the UI thread, but the issue is still there.

    I don't think you have to delete it. Just set it to nullptr, it will self destruct by itself due to ref counting.

  • PaintChat GUI thread issue using Swing

    Hi there, I'm making a paintchat program for fun and have gotten it to work locally but now I would like to add the networking parts in. I have a function like this in a class called Util:
    public static NewscastMessage sendMessage(NewscastMessage message, int srcID, IPeerDescriptor dstPeer) {
    System.out.println("sending message");
    NewscastMessage replyMessage = null;
    String errorMessage = null;
    try {
    Socket socket = new Socket(dstPeer.getAddress(), dstPeer.getPortNumber());
    socket.setSoTimeout(5 * 1000); // timeout to 30 seconds
    ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());
    ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
    out.writeObject(message);
    replyMessage = (NewscastMessage)in.readObject();
    out.close();
    in.close();
    socket.close();
    return replyMessage;
    } catch (ConnectException ex) {
    Logger.getLogger(PeerClient.class.getName()).log(Level.SEVERE, ex.getMessage());
    errorMessage = ex.getMessage();
    } catch (SocketTimeoutException ex) {
    Logger.getLogger(PeerClient.class.getName()).log(Level.SEVERE, ex.getMessage());
    errorMessage = ex.getMessage();
    } catch (IOException ex) {
    Logger.getLogger(PeerClient.class.getName()).log(Level.SEVERE, ex.getMessage());
    errorMessage = ex.getMessage();
    } catch (ClassNotFoundException ex) {
    Logger.getLogger(PeerClient.class.getName()).log(Level.SEVERE, ex.getMessage());
    errorMessage = ex.getMessage();
    } catch (RuntimeException ex) {
    Logger.getLogger(PeerClient.class.getName()).log(Level.SEVERE, ex.getMessage());
    errorMessage = ex.getMessage();
    return new NewscastError(srcID, "While trying to send a message to the Peer with id [ " +
    dstPeer.getId() + " ] that has the ip address " + dstPeer.getAddress() + ". \nException on peer " + srcID + ": " + errorMessage);
    Essentially when a user types a message into a text field and presses enter, I catch the event and append the text into a text area locally then afterwards I'd like to send this message to a peer via Util.sendMessage. When it gets to this sending part, this error occurs:
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    I thought it might be some issues with the event lock and surrounded the call to sendMessage with a synchronize block and didn't work. Any ideas? Thanks in advance.

    Sorry forgot to attach the later part:
    private void sendTextToDestination(String text){
    // send via socket
    synchronized (this) {
    IPeerDescriptor dst = _peer.getPartialView().getOwnerPeerDescriptor();
    NewscastText message = new NewscastText(_peer.getPortNumber(), text);
    NewscastMessage replyMessage = null;
    replyMessage = Util.sendMessage((NewscastMessage) message, _peer.getPortNumber(), dst);
    private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {                                           
    String newline = "\n";
    String text = jTextField1.getText();
    jTextArea1.append(text + newline);
    jTextField1.selectAll(); // after pressing enter, highlight text
    //Make sure the new text is visible, even if there
    //was a selection in the text area.
    jTextArea1.setCaretPosition(jTextArea1.getDocument().getLength());
    synchronized(this){
    sendTextToDestination(text); -------> this is where the error occurs
    }

  • Threading issues - Best way to debug

    Hey everyone... I have a small server program that I wrote in Java. Its module based where each thread that is created runs through a list of modules and returns the output. It works just fine and I am doing a little stress test using Siege. I set it up running 50 concurrent users with no delay and take millions of requests with no errors at all.
    However, when I move it up to 125 concurrent users, I start getting NullPointerExceptions on a fairly routine basis (inside of one of the modules). The server is still running with no issues, just with that many users it appears to have a bug.
    I was wondering what the best way figure out why this would be happening. Or is this kind of thing to be expected and I should just implement some method of throttling for the threads. I plan to do that eventually, just trying to get the bugs out first.
    Thanks in advance!

    I think you are seeing the NPE concurrent scenario because of the assumptions you code is making about how JVM should behave. You code may be making assumption of "happens-before" pattern which may seem valid when you look at the code, but in fact are not.
    Take a look at this presentation that outlines the Java Memory model and defines the contract between concurrent programs and JVM.
    http://developers.sun.com/learning/javaoneonline/j1sessn.jsp?sessn=TS-1630&yr=2006&track=coreplatform
    Throttling the method is a bad idea (and a cop out). How would you arrive at the optimal number threads that can safely access your program ? Will your code be portable when it is deployed on a computer with different computing power than what you are testing on ?
    Hope this helps.
    -Prashant

  • Multiple threads issue

    here's the issue:
    if there was a Thread.waitFor() method I wouldn't have an issue.
    here's the situation:
    I have a method (M) that calls a thread (T). Inside T there is a JOptionPane (JOP) that is called inside a try-catch. After the call to M there is a while loop to check if T.isAlive() and sleep if it is, to prevent the main from continuing without waiting for T.
    here's the problem:
    When T hits the JOP the JVM hangs in the while loop after M. The only way to exit is to kill the JVM...
    Is there any way to have M wait to return with out calling another thread.sleep. It's basically a T.waitFor() but java doesn't have one...
    here's the psuedo code:
    main() {
    M();
    while (T.isAlive()) {
    Thread.sleep(1000);
    M () {
    T.start();
    T extends Thread {
    run() {
    try {
    something
    catch {
    JOP();
    </PRE>

    first off, the sleep() method has to be within a try...catch block. i think in the real program you did it like that though. i think you should try putting all the thread related stuff like the sleep() method into a synchronized block. if all that fails, dont let the thread sleep, but have it waiting, and give the other thread a reference to the calling thread. when the thread is finished simply call the notify() or notifyAll() method (Im not sure which one) on the first thread and itll continue. those calls have to be synchronized too, though. hope this helps

  • WebLogic 11g - Stuck Thread issue observed during MS-ADS authentication

    Hi
    We have weblogic server 10.3.5 installed on RHEL 5.6. For our application authentication, we are getting user credentials authenticated for application login page using Microsoft Active Directory Service (MS-ADS) configured under WebLogic Security Realm. We are getting the below error message now due to STUCK Thread observed at JVM level.
    Could you please help me to fix this issue and my thanks in advance.
    ]", which is more than the configured time (StuckThreadMaxTime) of "600" seconds. Stack trace:
    Thread-6424 "[STUCK] ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)'" <alive, suspended, waiting, priority=1, DAEMON> {
    -- Waiting for notification on: netscape.ldap.LDAPResponseListener@3a8ecc70[fat lock]
    java.lang.Object.wait(Object.java:???)
    java.lang.Object.wait(Object.java:485)
    netscape.ldap.LDAPMessageQueue.waitForMessage(LDAPMessageQueue.java:198)
    netscape.ldap.LDAPMessageQueue.waitFirstMessage(LDAPMessageQueue.java:100)
    netscape.ldap.LDAPConnection.sendRequest(LDAPConnection.java:1782)
    ^-- Holding lock: netscape.ldap.LDAPConnection@3a8ecc83[thin lock]
    netscape.ldap.LDAPConnection.simpleBind(LDAPConnection.java:1752)
    netscape.ldap.LDAPConnection.authenticate(LDAPConnection.java:1260)
    netscape.ldap.LDAPConnection.authenticate(LDAPConnection.java:1273)
    netscape.ldap.LDAPConnection.authenticate(LDAPConnection.java:1240)
    netscape.ldap.LDAPConnection.referralRebind(LDAPConnection.java:4955)
    netscape.ldap.LDAPConnection.performReferrals(LDAPConnection.java:5065)
    netscape.ldap.LDAPConnection.checkSearchMsg(LDAPConnection.java:2632)
    netscape.ldap.LDAPConnection.search(LDAPConnection.java:2500)
    weblogic.security.providers.authentication.LDAPAtnDelegate.getDNForUser(LDAPAtnDelegate.java:3667)
    weblogic.security.providers.authentication.LDAPAtnDelegate.authenticate(LDAPAtnDelegate.java:3513)
    weblogic.security.providers.authentication.LDAPAtnLoginModuleImpl.login(LDAPAtnLoginModuleImpl.java:145)
    com.bea.common.security.internal.service.LoginModuleWrapper$1.run(LoginModuleWrapper.java:110)
    com.bea.common.security.internal.service.LoginModuleWrapper.login(LoginModuleWrapper.java:101)
    sun.reflect.GeneratedMethodAccessor2808.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:575)
    javax.security.auth.login.LoginContext.invoke(LoginContext.java:720)
    javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
    javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
    javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
    javax.security.auth.login.LoginContext.login(LoginContext.java:566)
    com.bea.common.security.internal.service.JAASLoginServiceImpl.login(JAASLoginServiceImpl.java:77)
    sun.reflect.GeneratedMethodAccessor366.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:575)
    com.bea.common.security.internal.utils.Delegator$ProxyInvocationHandler.invoke(Delegator.java:57)
    $Proxy28.login(Unknown Source)
    weblogic.security.service.internal.WLSJAASLoginServiceImpl$ServiceImpl.login(WLSJAASLoginServiceImpl.java:81)
    com.bea.common.security.internal.service.JAASAuthenticationServiceImpl.authenticate(JAASAuthenticationServiceImpl.java:74)
    sun.reflect.GeneratedMethodAccessor364.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:575)
    com.bea.common.security.internal.utils.Delegator$ProxyInvocationHandler.invoke(Delegator.java:57)
    $Proxy46.authenticate(Unknown Source)
    weblogic.security.service.WLSJAASAuthenticationServiceWrapper.authenticate(WLSJAASAuthenticationServiceWrapper.java:29)
    weblogic.security.service.PrincipalAuthenticator.authenticate(PrincipalAuthenticator.java:339)
    weblogic.security.services.Authentication.doLogin(Authentication.java:127)
    weblogic.security.services.Authentication.login(Authentication.java:69)
    weblogic.security.services.Authentication.login(Authentication.java:51)
    in.sis.ps.view.template.user.UserAdapter.doLogin(UserAdapter.java:681)
    sun.reflect.GeneratedMethodAccessor2824.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:575)
    com.sun.el.parser.AstValue.invoke(Unknown Source)
    com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
    org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:85)
    org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:171)
    oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
    oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:447)
    oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:122)
    oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:106)
    oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
    oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:447)
    oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:122)
    oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:106)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:720)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1247)
    oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:964)
    oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:259)
    oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:181)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:284)
    weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:224)
    weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:108)
    weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:206)
    weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:55)
    oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:115)
    weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:55)
    oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:65)
    org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:459)
    oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:44)
    org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:459)
    org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:253)
    org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:148)
    org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:91)
    weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:55)
    oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
    oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:299)
    oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:405)
    oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
    oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:98)
    oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
    weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:55)
    oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:86)
    weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:55)
    weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:25)
    weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:55)
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3687)
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:308)
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:116)
    weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2213)
    weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2135)
    weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1420)
    weblogic.work.ExecuteThread.execute(ExecuteThread.java:203)
    weblogic.work.ExecuteThread.run(ExecuteThread.java:170)
    }

    Hi,
    make sure to keep your Authentication provider in provider specific select group member search as limited where as default would be unlimited.
    Once you made this changes then it will solve this issue.
    Regards,
    Kal

Maybe you are looking for

  • H.264 Web based Encoder Demo

    Hi, before some weeks ago i red a newsletter that adobe has include a h.264 encoder in FP 11. Well, here we go i thought and start to develope a web based h.264 encoder for our CDN. Here is a first version that i want to share with you developers. On

  • I do not want Bridge to be the default program for opening folders.

    I have recently upgraded from CS5.5 to CS6 Design and Web Premium. Since my upgrade, when I click on any "folder" IExplorer no longer is my default browser for my folders. Bridge now opens all my folders. This is very annoying. I DO NOT want Bridge t

  • Button not working on my Iphone 5

    I just got the IPhone 5 less then two months ago and the button on top of the phone does not work anymore has anyone else have had this problem as well? I am really upset that this expensive phone is already broke in less then two months. I never onc

  • For Anyone who has Blackberry Connect WITH OTA Con...

    I've tried with an E61i, E90, and now E51, all with the latest firmware and latest Blackberry Connect software, and nothing I do on the device allows me to be able to do OTA sync of our corporate Exchange, (Outlook), Contacts. I only have the standar

  • Samsung 10.1 ff error loading page

    As suggested i installed v22 ff beta still won't open link from email that IE opens w/o problem anyhelp?