Thread Interaction

I am writing a server - client program to transfer some data. First the main listens for a socket connection (main thread)
while (listening) new ServerComm(serverSocket.accept()).start();The class ServerComm(socket) is the second thread, it also implements an interface called PacketReader:
public interface PacketReader {
     public void processPacket(CommPacket packet);
public class ServerComm extends Thread implements PacketReader {
    private Socket socket = null;
    private CommTxRx comm = null;
    private boolean ack = false;
    private int status = 0x00;
    public ServerComm(Socket socket) {
      super("ServerComm");
      this.socket = socket;
    public void run() {
        comm = new CommTxRx(socket,this); comm.start();
        synchronized (this) {
             while (status != DONE || status != ABORT) {
                  try { wait(400);
                    } catch (InterruptedException e) { status = ABORT; }
          comm.close();
     public void processPacket(CommPacket packet) {
          switch (packet.cmd) {
            case CommDef.ACK: ack = true;
}CommTxRx actually does the reading and writing to the socket, and it is also a thread. It calls processPacket() when it recieves a new data packet
public class CommTxRx extends Thread {
     private Socket socket = null;
    private ObjectInputStream in = null;
    private ObjectOutputStream out = null;
    private PacketReader reader = null;
    private boolean streamOk = false;
    public boolean abort = false;
    public boolean pause = false;
    public CommTxRx(Socket socket, PacketReader reader) {
      this.socket = socket; this.reader = reader;
    public void run () {
         try {
            in = new ObjectInputStream(socket.getInputStream());
          out = new ObjectOutputStream(socket.getOutputStream());
         } catch (IOException e) {
          System.err.println("Stream Setup Error");
          streamOk = false;
          return;
         streamOk = true;
         synchronized(this) {
            while(streamOk) {
             try { this.wait(20); } catch (InterruptedException e) {
                      if (abort) close();
             try {
               if (in.available() != 0 && reader != null && !pause ) {
                    reader.processPacket(read());
           } catch (IOException e) { System.out.println("Read err"); }
             catch (ClassNotFoundException n) {System.out.println("Read err CNF");}
    public CommPacket read() throws IOException, ClassNotFoundException  {
        if (!streamOk) return null;
        return (CommPacket) in.readObject();
    }Here is my question, is this actually going to work, calling the processPacket inside the ServerComm thread from the CommTxRx thread, and does the CommRxTx thread suspend until the code in the ServerComm thread completes. What I would like to do is when a packet arrives and is processed by processPacket, it sends a reply and then waits until an ack packet is received, that would mean a second instance of processPacket would have to be launched to change the ack boolean, that would be in a wait() loop in the first call to processPacket. Am I going to have to setup every processPacket as a thread also in order to make that happen or because I already have two threads running is that going to work. I have not written the code to do that yet, I would like to find out if it is going to work before I get that far.

          while(streamOk) {
          try { this.wait(20); } catch (InterruptedException e) {Pointless. Remove.
               if (in.available() != 0 && reader != null && !pause ) {
                    reader.processPacket(read());Pointless. Remove. Just block in the readObject() method. If you want to poll, set a short read timeout.
I don't see the need for this class & thread at all, it should all be folded into the previous one.

Similar Messages

  • Cross Thread Interaction

    Hi to everyone,
    I am a C# developer and I am making the move to Java and I have something I'd like to ask about Java Threads.
    I have a Main class that starts 3 Threads. The first scans an external drive recursively, the second opens and reads in some details from some very large log files (in excess of 150mb's), and the third deals with the GUI.
    I have these 3 items as threads because I want the application to appear as responsive as possible without the screen freeze that happens without them. (the GUI might not have to stay in a thread but it is for now).
    My question is, how can I get the directory scanning thread and the log file reader thread to put the data they gather into textAreas that are on the GUI thread?
    In C#, Microsoft's idea is that only the Thread that created a control should be able to interact with it (although this can be changed by setting CheckForIllegalCrossThreadCalls to false) and while this is obviously for safety it is often awkwardly restrictive.
    So how do I go about this in Java?
    I could do this ever-so simply in C# but it has been requested that this be done in Java, and I am in agreement as running on Linux is a must (Mono has been ruled out.) and I rather like Java.
    Any advice would be greatfully appreciated.

    If you are using java 5 or 6, did you consider package [java.util.concurrent|http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html|javadoc]? - "Utility classes commonly useful in concurrent programming."

  • Interactive report performance problem over database link - Oracle Gateway

    Hello all;
    This is regarding a thread Interactive report performance problem over database link that was posted by Samo.
    The issue that I am facing is when I use Oracle function like (apex_item.check_box) the query slow down by 45 seconds.
    query like this: (due to sensitivity issue, I can not disclose real table name)
    SELECT apex_item.checkbox(1,b.col3)
    , a.col1
    , a.col2
    FROM table_one a
    , table_two b
    WHERE a.col3 = 12345
    AND a.col4 = 100
    AND b.col5 = a.col5
    table_one and table_two are remote tables (non-oracle) which are connected using Oracle Gateway.
    Now if I run above queries without apex_item.checkbox function the query return or response is less than a second but if I have apex_item.checkbox then the query run more than 30 seconds. I have resolved the issues by creating a collection but it’s not a good practice.
    I would like to get ideas from people how to resolve or speed-up the query?
    Any idea how to use sub-factoring for the above scenario? Or others method (creating view or materialized view are not an option).
    Thank you.
    Shaun S.

    Hi Shaun
    Okay, I have a million questions (could you tell me if both tables are from the same remote source, it looks like they're possibly not?), but let's just try some things first.
    By now you should understand the idea of what I termed 'sub-factoring' in a previous post. This is to do with using the WITH blah AS (SELECT... syntax. Now in most circumstances this 'materialises' the results of the inner select statement. This means that we 'get' the results then do something with them afterwards. It's a handy trick when dealing with remote sites as sometimes you want the remote database to do the work. The reason that I ask you to use the MATERIALIZE hint for testing is just to force this, in 99.99% of cases this can be removed later. Using the WITH statement is also handled differently to inline view like SELECT * FROM (SELECT... but the same result can be mimicked with a NO_MERGE hint.
    Looking at your case I would be interested to see what the explain plan and results would be for something like the following two statements (sorry - you're going have to check them, it's late!)
    WITH a AS
    (SELECT /*+ MATERIALIZE */ *
    FROM table_one),
    b AS
    (SELECT /*+ MATERIALIZE */ *
    FROM table_two),
    sourceqry AS
    (SELECT  b.col3 x
           , a.col1 y
           , a.col2 z
    FROM table_one a
        , table_two b
    WHERE a.col3 = 12345
    AND   a.col4 = 100
    AND   b.col5 = a.col5)
    SELECT apex_item.checkbox(1,x), y , z
    FROM sourceqry
    WITH a AS
    (SELECT /*+ MATERIALIZE */ *
    FROM table_one),
    b AS
    (SELECT /*+ MATERIALIZE */ *
    FROM table_two)
    SELECT  apex_item.checkbox(1,x), y , z
    FROM table_one a
        , table_two b
    WHERE a.col3 = 12345
    AND   a.col4 = 100
    AND   b.col5 = a.col5If the remote tables are at the same site, then you should have the same results. If they aren't you should get the same results but different to the original query.
    We aren't being told the real cardinality of the inners select here so the explain plan is distorted (this is normal for queries on remote and especially non-oracle sites). This hinders tuning normally but I don't think this is your problem at all. How many distinct values do you normally get of the column aliased 'x' and how many rows are normally returned in total? Also how are you testing response times, in APEX, SQL Developer, Toad SQLplus etc?
    Sorry for all the questions but it helps to answer the question, if I can.
    Cheers
    Ben
    http://www.munkyben.wordpress.com
    Don't forget to mark replies helpful or correct ;)

  • Interactive report : issue with french special characters

    Hi,
    We have many interactive reports and we can't use any french special characters in the filter clauses. For example, Montréal becomes montréal.
    What parameters do we have to change to make it work?
    Thanks.

    I found the answer in this thread : Interactive Report Character Set Issue

  • Threads treading on one another's feet...

    Dear All,
    I wonder whether you could help me with a couple of threads treading on one another's feet.
    Following is the class in question, which represents a sort of simple semaphore on object locking. The only two states allowed should be 0 and 1, respectively available and not available. (just for study purposes) immagine then Thread1 and Thread2 calling both acquire() and release() in their run() methods.
    <code>
    public class Atomic {
    private volatile int semaphore = 0;
    public void acquire() { semaphore = semaphore + 1; }
    public void release() { semaphore = semaphore - 1; }
    </code>
    and this is the javap -c Atomic result:
    <code>
    Compiled from Atomic.java
    public class Atomic extends java.lang.Object {
    public Atomic();
    public void acquire();
    public void release();
    Method Atomic()
    0 aload_0
    1 invokespecial #1 <Method java.lang.Object()>
    4 aload_0
    5 iconst_0
    6 putfield #2 <Field int semaphore>
    9 return
    Method void acquire()
    0 aload_0
    1 aload_0
    2 getfield #2 <Field int semaphore>
    5 iconst_1
    6 iadd
    7 putfield #2 <Field int semaphore>
    10 return
    Method void release()
    0 aload_0
    1 aload_0
    2 getfield #2 <Field int semaphore>
    5 iconst_1
    6 isub
    7 putfield #2 <Field int semaphore>
    10 return
    </code>
    When two threads interact on this particular object, the possible values for semaphore held in an unstable state are 2 and -1.
    If it's quite simple to account for 2, it's not so for -1.
    I would like to understand why. Furthermore, I have just approched opcodes, so don't take anything for granted, please.
    One more question: are incrementing and decrementing atomic operations, is then every single opcode an atomic operation?
    P.s. and the purpose of volatile in case?
    Thank you for your time
    luca

    It may be best to include the full example (from Eckel's Thinking in Java):
    //: c13:Invariant.java
    public interface Invariant {
    InvariantState invariant();
    //: c13:InvariantOK.java
    // Indicates that the invariant test succeeded
    public class InvariantOK implements InvariantState {}
    //: c13:InvariantFailure.java
    // Indicates that the invariant test failed
    public class InvariantFailure implements InvariantState {
    public Object value;
    public InvariantFailure(Object value) {
    this.value = value;
    //: c13:Semaphore.java
    // A simple threading flag
    public class Semaphore implements Invariant {
    private volatile int semaphore = 0;
    public boolean available() { return semaphore == 0; }
    public void acquire() { ++semaphore; }
    public void release() { --semaphore; }
    public InvariantState invariant() {
    int val = semaphore;
    if(val == 0 || val == 1)
    return new InvariantOK();
    else
    return new InvariantFailure(new Integer(val));
    //: c13:SemaphoreTester.java
    // Colliding over shared resources
    public class SemaphoreTester extends Thread {
    private volatile Semaphore semaphore;
    public SemaphoreTester(Semaphore semaphore) {
    this.semaphore = semaphore;
    setDaemon(true);
    start();
    public void run() {
    while(true)
    if(semaphore.available()) {
    yield(); // Makes it fail faster
    semaphore.acquire();
    yield();
    semaphore.release();
    yield();
    public static void main(String[] args) throws Exception {
    Semaphore sem = new Semaphore();
    new SemaphoreTester(sem);
    new SemaphoreTester(sem);
    new InvariantWatcher(sem).join();
    When I run the programme on my Pentium 133 with Windows 95, the InvrianteWatcher
    detects the semaphore's value in an invalid state (2). If you remove all the yields() withing the run() method
    the InvariantWatcher detect -1. What I'd like to know is the sequence of opcodes (the mixing of both threads)
    that would set semaphore's value to 2 and -1.
    I would be grateful if you could be as thorough as possible in your explanaition.
    I only trying to get a deeper understanding of the underlaying logic of threads.
    Many thanks
    Luca

  • Threads Question/Opinion

    I am currently developing an application that will create a process. The process itself will be cmd.exe with parameters. The application is Swing based and so I don't lock the event dispatch thread, I created a thread that will create the process. I also know that when using cmd.exe it is important to handle the inputstream and errorstream so the whole process does not lock. The examples I've seen for handling these streams where handled in threads of their own so they could be processed at the same time. My question is this: In your opinion would it be better to handle the process and streams in one thread, or should I create one thread to create the process and 2 threads to handle the streams (1 thread for each stream)? I think the multiple threads (essentially 3 for one process) will negatively impact the applications performance, but I don't know if handling the streams in a function/method within one thread would be adequate enough to keep the app from deadlocking. Any ideas?

    I had read that multiple threads can cause more
    e overhead and slow performance of the application in
    general. The article just said more threads=more
    overhead, Fair enough. That's true as far as it goes, but I can't imagine 3 threads ever causing any detectable problem, unless each thread is something like this public void run() {
        someField_++;
        Thread.yield();
    } It's not uncommon to have tens of threads, and I've created thousands in little dummy test programs and not noticed performance problems.
    I didn't have an exact number to work with
    and that was my concern. I believe the threads I was
    thinking of would perform the needed actions quickly
    and therefore not impact performance too much, but I
    wanted to be sure. The key is that each thead does enough at one time so that the overhead of switching is small compared to the work done, but also making sure that no thread hogs the CPU for too long. If you're doing I/O, then each call to read has the potential to let another thread have a turn, I believe. Otherwise it's common to put a call to yield in your thread's main loop. Maybe every iteration, maybe every 10 or 100 or whatever, depending on what that iteration does.
    If you have tasks that can be handled in parallel--indpendently of one another--or should be independent to prevent one from forcing another to wait (like reading two streams) then you should give those tasks separate threads. Once you have that working correctly, then if you have measured performance problems relating to how those threads interact or take turns (or don't take turns) then you can tweak the code to try to optimize that aspect of it.
    I am teaching myself Java and its
    been a bit of a haul. I appreciate the help and
    information I get from these forums hence this
    posting.Cool. Glad to be of help.

  • Pass messages between main thread and FX application thread

    I'm launching an FX Application thread from a Main thread using Application.launch [outlined here: {thread:id=2530636}]
    I'm trying to have the Aplication thread return information to the Main thread, but Application.launch returns void. Is there an easy way to communicate between the Main thread and the Application thread?
    So far I have googled and found:
    - MOM (Message Orientated Middleware)
    - Sockets
    Any thoughts/ideas/examples are appreciated - especially examples ;) - right now I am looking at using Sockets to show/hide the application and for passing data.
    What is the preferred method? Are there others which I have not found (gasp) via Google?
    Dave.
    Edited by: cr0ck3t on 30-Apr-2013 21:04
    Edited by: cr0ck3t on 30-Apr-2013 21:05

    Is there an easy way to get a reference to these objects from both the Main thread and the FX Application thread - called via Application.launch() from the Main thread? Or do I have to use Sockets or MOM?Not much to do with concurrent programming is what I would call easy. It seems easy - but it's not.
    You can kind of do what you are describing using Java concurrency constructs without using sockets or some Message Oriented Middleware (MOM) package.
    With the Java concurrency stuff you are really implementing your own form or lightweight MOM.
    If you have quite a complex application with lots of messages going back and forth then some kind of MOM package such as camel or ActiveMQ (http://camel.apache.org) is useful.
    You can find a sample of various thread interactions with JavaFX here:
    https://gist.github.com/jewelsea/5500981 "Simulation of dragons eating dwarves using multiple threads"
    Linked code is just demo-ware to try out different concurrency facilities and not necessarily a recommended strategy.
    If your curious, you could take a look at it and try to work out what it is, what it does and how it does it.
    The main pattern followed is that from a blocking queue:
    http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/BlockingQueue.html
    Note that once you call launch from the main thread, no subsequent statements in the main method will be run until the JavaFX application shuts down. So you can't really launch from the main thread and communicate with a JavaFX app from the main thread. Instead you need to spawn another thread (or set of threads) for communication with the JavaFX app.
    But really, in most cases, the best solution with concurrency is not to deal with it at all (or at least as little as possible). Write everything in JavaFX, use the JavaFX animation framework for timing related stuff and use the JavaFX concurrency utilities for times when you really need multiple thread interaction.
    http://docs.oracle.com/javafx/2/threads/jfxpub-threads.htm
    To get further help, you might be better off describing exactly (i.e. really specific) what you are trying to do in a new question, perhaps with a sample solution in an sscce http://sscce.org

  • How to increase rowcount on clicking on Interactive page header

    Hi All,
    I have create Interactive report on table which has more than 3 Lakhs records. If click on Document Name it showing only 1000 distinct names.
    Where can I increase these value to sort and see the all values.
    Apex version 3.2
    Thank,
    NR

    Hi,
    For performance reason it will only show first 1000 distinct values when you click on ir report headers, you cannot increase it.
    You can workaround this by going into Actions > Filter
    I suggest to follow this active thread Interactive Report (IR) column heading: filtered items number & flashlight
    Thanks

  • Error testing Web Dynpro Callable Object (GP Interface)

    With reference to thread:
    Interactive form as  Callable object error on testing the object.
    FYI, I'm running NW04s, EP 7.0 SPS 13, JDK 1.4.2_14, Unix OS
    Hi All,
    I have created a Web Dynpro App with a Adobe Form as the frontend. I have included the caf/eu/gp/api as a DC and implemented the IGPWebDynproCO interface. Next I created a Web Dynpro Callable object in GP and ran a test and received the following error:
    Result: Technical Exception
    Details: Could not create web dynpro callable object component
    Output Parameters
    Callable object implementation did not return  output parameters
    Can anyone help me resolve this? Do I have to make a manual entry in the HOST file? If so, what is that entry? Are there alternatives?
    Thanks
    Kunal.

    Hi,
    For creating WD callable object you need to add following three DC in your WD DC project.
    In the Web Dynpro Explorer of the Web Dynpro Perspective, expand the node DC MetaData -> DC Definition, and select Used DCs.
    a.      To create a DC dependency, open the context menu and choose Add Used DC.
      b.      Select Local Development  -> SAP-EU  -> caf/eu/gp/api/wd  -> DC MetaData  -> Public Parts  -> GPWebDynproCO. For Dependency Type, select Build Time, Design Time, and Run Time. Choose weak from the dropdown list.
      c.      Repeat the previous step to define a dependency to DCs SAP-EU-> caf/eu/gp/api (public part external) and SAP-JEE -> com.sap.security.api.sda (public part default).
    You need to do one more thing like bellow.
    Select your Web Dynpro project and open its context menu. Choose Properties.
    1. Choose Web Dynpro References -> Library References.
    2.  Add a reference for library caf/eu/gp/api.
    I think this will help you.
    Thanks
    Chandan

  • Seeking runtime mutex analysis tool

    I am using Sun C++ 5.5 on Solaris 8, on an Ultra 10.
    Does there exist a "known reliable" tool for tracking (logging, analyzing, reporting) a Solaris application's RUN TIME operationis on Solaris mutexes?
    I've written such a tool, myself, but if I am to believe its current reports there are serious flaws in the Solaris mutex mechanism on Solaris 8. I conclude, instead, that my tool is broken and that I should try to find an equivalent tool that actually WORKS.
    So, I would appreciate either pointers to such (a) tool(s) -- OR confirmation that there are, indeed, serious flaws in the Solaris mutex mechanism on Solaris 8 and that my homebrewed tool is truthful... ;-)
    Thanks in advance,
    Chris

    Yes, I use the -mt option on all builds -- actually I use an "in-house standard" Makefile that sets this for me, every time.
    It is not clear what luck I will have with the thread-library patches -- I am not in a position to use them myself, but must talk a separate sysadmin department into handling it for me -- but thank you, nonetheless, for the suggestion. It's also possible that the patches in question are already installed; only "they" will know.
    I will also definitely try the "optional new thread library." Had not heard about that one. Is there something, somewhere, that I can read that will tell me what differences in behavior I might expect to see?
    Details of my observations are ... difficult... to convey, due to sheer volume; I'll do my best to summarize here, but I apologize for the length of what follows.
    First, truss of a small "test app," running for about 20 minutes (super-slow due to truss itself; equivalent to about two minutes at "normal" speed) produces over 1.5 million lines (62 Mbytes) of output. Heavy postprocessing to select just the operations associated with a single mutex produces a 47Kb file, most of which is inoccuous (sp?). Here and there, however, I observe sequences along the lines of the following (the parenthesized numbers are mine, for the sake of reference; the rest is pretty much exactly what truss puts out):
    (1)   /4 -> mutex_lock(0xc68cb, ... (other args here)...)
    (2)   /4 <- mutex_lock(0xc68cb, ... (other args here)...) = 0
    (3)   /5 -> mutex_lock(0xc68cb, ... (other args here)...)
    (4)   /5 <- mutex_lock(0xc68cb, ... (other args here)...) = 0
    (5)   /5 -> mutex_unlock(0xc68cb, ... (other args here)...)
    (6)   /5 <- mutex_unlock(0xc68cb, ... (other args here)...) = 0
          .  (repeat thread-5 lock-unlock pairs, numerous times, here)
    (7)   /4 -> mutex_unlock(0xc68cb, ... (other args here)...)
    (8)   /4 <- mutex_unlock(0xc68cb, ... (other args here)...) = 0Taking this at face value, my interpretation is as follows:
    - at line 1, thread 4 requests a lock on the mutex.
    - at line 2, thread 4 is granted the requested lock on the mutex
    - at line 3, thread 5 requests a lock on the mutex. I would expect this request to block, due to thread 4's existing lock, such that we would not see the completion of this request until after an unlock performed by thread 4. However...
    - at line 4, thread 5 is granted a lock on the mutex! If truss is telling us the bald-faced truth about the sequence of operations here, this lock should not have been granted, because thread 4 already held a lock on this mutex!
    - in lines 5 and 6, we see thread 5 unlocking the mutex (which it "should never have been able to lock in the first place");
    - between lines 6 and 7, but omitted here for the sake of brevity, I see ten or twenty duplicates of the sequence of operations in lines 3 through 6, namely, thread 5 locking-and-unlocking the mutex, entirely successfully (return value of 0) and without blocking (no other threads doing anything in between thread 5's activities)
    - finally, in lines 7 and 8,, we see thread 4 unlocking the mutex that it locked at line(s) 1 (and 2).
    The only explanations I can come up with, for the observed sequence -- which is seen in several other places in the log file, for this and several other mutexes, and on every run of the test program -- are these:
    1) truss is 100% truthful and accurate in its reporting of mutex operations, in particular with regard to their exact sequencing, and the mutex facility does, in fact, occasionally allow thread 5 to lock a mutex already locked by thread 4. (I know for a fact that the facility allows e.g. thread 5 to unlock a mutex held by thread 4; there's another post somewhere in this forum about this being done deliberately in a piece of questionable code. I consider it somewhat of a flaw that the mutex facility allows this at all, but other people here argue that there "may be compelling reasons" (i.e. deep in the theoretical department at Sun) for "things being the way they are" in this respect. Anybody know for sure?)
    2) Multi-threading being what it is -- a complex, subtle, and oft-unwieldy beast -- truss "gets confused" in some subtle way, and ends up reporting events in a slightly different sequence than they actually occurred. In the particular case outlined here, for example, perhaps thread 4 did unlock the mutex "right after it locked it," but truss, for whatever reasons, didn't report it right away -- namely, not until after thread 5 had perfectly "legally" locked-and-unlocked the mutex a few times. (Alas, it's not clear why truss would get around to reporting thread 5's activities, before getting around to reporting thread 4's activities previously completed. It almost seems to require large amounts of latency on all threads, interacting in a complex manner. I can just manage to leave mental "elbow room" for this, because I don't know exactly how truss works.. It's harder, though, to shrug off the essentially-identical results produced by code of my own, whose inner workings I do know, and which I would have trusted implicitly if it hadn't started delivering reports like these in the first place.
    So, folks, the burning question is, which, if either, of these two conclusions can we confirm? If it's the former, we have serious problems, but should face them squarely and fix them. If it's the latter, I would desperately love to hear it -- with believable supporting details -- from Someone Who Really Knows, so that I can simply shrug off the disturbing "evidence" and write off the whole issue of realtime mutex-tracing as "one of those things that can never quite be nailed down."
    Thanks for listening.

  • CRM 2007 CIC Architecture

    Hi All,
    Can you please let me know any link for current CRM 2007 architecture.
    Moreover CRM 2007 CIC Architecture - any SAP standard info available.
    I know cross posting is very bad habit, but by mistake I posted in CRM 2007 instead of this community.
    Sorry.
    Regards,
    Jitender

    Hello Jitender,
    When you refer CIC do you mean IC Winclient?
    If so, unfortunally winclient is no longer supported in that version. The only Interaction Center that is supported in that version is the IC WebClient.
    For more details, check John Burton answer in the following thread:
    Interaction Center WinClient in CRM 6.0?
    Kind regards,
    Bruno

  • Classic Report Sort problem

    I have a classic report that retrieves data based on the value in an item. When the page first opens the report retrieves properly. However, the strange thing is when I try to sort the rows by pressing the column header, I receive "No Data Found".
    The report is just very basic. Selecting a few columns from a table where ID = :P3_ID.
    If I change the where clause to be WHERE ID like '%' || :P3_ID, when it initially retrieves, I receive the data for the value in P3_ID. However, when I sort the report by a column header, it retrieves everything. It is as if P3_ID has been set to NULL or a blank eventhough it displays the proper ID.
    Any ideas?
    Thanks,

    Hi Brian,
    see the following thread Interactive Reports: problem with textfield as parameter for an explanation
    Patrick
    *** New *** Oracle APEX Essentials *** http://essentials.oracleapex.info/
    My Blog, APEX Builder Plugin, ApexLib Framework: http://www.oracleapex.info/

  • Why does JavaFX deployment rely on javascript and connecting to sun servers

    I understand that there's a way to deploy javafx applets and jnlp offline by downloading the required files from sun's website.
    But normally, it seems that a connection to sun servers must be made for anything to run and javascript has to be enabled to use applets.
    Why is connecting to sun servers necessary? especially, when the client already has the javafx runtime.
    What if the client loses internet connection or disables javascript, how can one run the JavaFX application/applet then?

    it seems that a connection to sun servers must be made for anything to runYes, it is (unfortunately) in the license, which doesn't allow to distribute the JavaFX software.
    See also two (at least) related threads: [Interaction between Swing and JavaFX?|http://forums.sun.com/thread.jspa?forumID=932&threadID=5362457] and [Distribution JavaFX application without web start|http://forums.sun.com/thread.jspa?threadID=5367483] with a kind of official answer.
    javascript has to be enabled to use appletsIt is a quite common requirement, people ready to run Java shouldn't be afraid to enable JavaScript... :-)
    Why is connecting to sun servers necessary?I suppose it is to ensure the latest runtime is used, for a better experience...
    What if the client loses internet connection or disables javascript, how can one run the JavaFX application/applet then?Well, if they don't have an Internet connection, I suppose they can't reach the page where the applet is... :-)
    Not necessarily true, the applet can be on a network and the Internet access can be deactivated.
    I haven't tried, but I think if the runtime is in cache, the applet can be run. Although the applet loading code or the JNLP can attempt to check for a new version, I don't know what happen when they cannot.

  • Help-- Using GZIPOutputStream, but never end.

    I written serialization object with GZIPOutputStream.
    But recent my Aplication hang 24 hours. I print stack , see the thread is runnable,and lock (0x20fbca10)
    Can any one help me?How the "Deflater.deflateBytes" never end?
    I have two thread.
    thread 1: write serialization object (when receive a message)
    thread 2: close GZip file(when a stop request)
    "RMI TCP Connection(22352)-10.9.146.14" daemon prio=6 tid=0x0792b8d8 nid=0x7b18 runnable [0x4b01d000..0x4b01fa18]
    java.lang.Thread.State: RUNNABLE
         at java.util.zip.Deflater.deflateBytes(Native Method)
         at java.util.zip.Deflater.deflate(Deflater.java:290)
         - locked <0x20fbca10> (a java.util.zip.Deflater)
         at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:159)
         at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:118)
         at java.util.zip.GZIPOutputStream.write(GZIPOutputStream.java:72)
         - locked <0x1ff90e98> (a java.util.zip.GZIPOutputStream)
         at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
         at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109)
         - locked <0x1f41f740> (a java.io.BufferedOutputStream)
         at java.io.FilterOutputStream.write(FilterOutputStream.java:80)
    "MessageListenerThread - F_LinkTopic" prio=6 tid=0x05def670 nid=0x16d8 waiting for monitor entry [0x0f90f000..0x0f90fd98]
    java.lang.Thread.State: BLOCKED (on object monitor)
         at java.util.zip.Deflater.deflate(Deflater.java:284)
         - locked <0x20fbca10> (a java.util.zip.Deflater)
         at java.util.zip.GZIPOutputStream.finish(GZIPOutputStream.java:86)
         at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:146)
         at java.io.FilterOutputStream.close(FilterOutputStream.java:143)

    I have seen an almost identical problem within an Apache CXF web service. In my situation the end of the stack looks almost identical, stuck forever (apparently) inside the native Deflater.deflateBytes.
    In my situation I have seen this with two threads, each independently using GZIPOutputStream.
    I am really starting to think that there is a thread safety issue with the native GZIP code - two independent objects in two threads are simultaneously zipping and both get stuck with 100% CPU utilization in the native code. Interestingly my situation is also in the close processing, but not inside the finish processing. Of all the situations I see with searching for similar situations (search the web for Deflater.java:306) there seems to be a set of common circumstances:
    * Exactly the same last few levels on the stack (ending in Deflater.deflateBytes (Native Method)
    * Two threads interacting with GZIP
    * Often seems to relate to close processing (perhaps a short data remainder problem?)
    My situation is documented here:
    http://www.java.net/forum/topic/glassfish/glassfish/glassfish-301-gzip-problem-threads-apparently-spinning-100-cpu-use
    Salient details of thread dump:
    "http-thread-pool-8080-(18)" - Thread t@950
    java.lang.Thread.State: RUNNABLE
    at java.util.zip.Deflater.deflateBytes(Native Method)
    at java.util.zip.Deflater.deflate(Deflater.java:306)
    - locked <21b0c5> (a java.util.zip.ZStreamRef)
    at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:159)
    at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:118)
    at java.util.zip.GZIPOutputStream.write(GZIPOutputStream.java:72)
    - locked <132ba84> (a java.util.zip.GZIPOutputStream)
    at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:46)
    at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
    at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:46)
    at org.apache.cxf.io.AbstractThresholdOutputStream.unBuffer(AbstractThresholdOutputStream.java:89)
    at org.apache.cxf.io.AbstractThresholdOutputStream.close(AbstractThresholdOutputStream.java:100)
    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
    at org.apache.cxf.transport.http.AbstractHTTPDestination$BackChannelConduit.close(AbstractHTTPDestination.java:619)

  • Unreliable behavior of MulticastSocket's receive method

    I have a program that uses one MulticastSocket to receive packets from a multicast address on a given port (running on a dedicated thread), and another MulticastSocket to send both multicast- and unicast-adressed packets from the same port (running on a separate thread). The program runs on a Windows system that communicates with a separate program (written in C++) running on a Linux system (more specifically, a Gumstix processor running Ubuntu). Both applications are written to send some messages by multicast, and others by direct unicast, with all sending and receiving being performed using the same port number.
    The problem I'm having is this... The MulticastSocket SOMETIMES receives packets sent by the remote system by BOTH multicast addressing AND unicast addressing, but other times, ONLY receives the packets sent by multicast addressing. By "sometimes" and "other times," I mean "distinct executions of the program." That is, if I run it one time, the MulticastSocket ALWAYS behaves one way, and if I run the same program again, it ALWAYS behaves the other way.
    I know that this smacks of thread-interaction issues, but I have done due diligence to rule this out as best I can.
    All of the documentation about MulticastSocket says that it is perfectly reasonable to create multiple MulticastSockets on the same socket address (i.e., the same port), by virtue of the fact that the class sets SO_REUSEADDR to true by default. But if the code never instantiates the sending MulticastSocket, the receiver seems to receive unicast-addressed packets quite reliably.
    How can I ensure that the receiving MulticastSocket behaves in a predictable manner? Are there known issues with this?

    I don't understand why you're using two MulticastSockets for this. You can send and receive from the same MulticastSocket simultaneously.

Maybe you are looking for