JFrame thread in ClientServer application?

I am creating a client/server application, mostly in Java.
It all runs on one box.
The reason for the client/server setup is that the application will consist of modules in different languages
with one module written in Visual Basic with a TCP/IP interface.
I will have something like this:
myJavaServer
|_ myVBModule
|_ myC++Module
|_ myJavaModule
myJavaServer is a thread.
myJavaServer and myVBModule will communciate via TCP/IP, in which each has a state machine
myJavaServer and myC++Module will probably communicate via the JNI.
myJavaServer will simply call myJavaModule methods.
myJavaServer calls myVBModule, myC++Module, and myJavaModule sequentially,
i.e. it can't call myC++Module until myVBModule is done, can't call myJavaModule until myC++Module is done, and when myJavaModule is done, it will loop back and call myVBModule.
Each is acting on the same set of data.
One part of this data is a 2D array which I would like to display and refresh once each time around the loop
The display will be some JPanels on a JFrame.
How do I best integrate this with the rest of the program?
Do I make it a separate Thread?

http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html
http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html
http://java.sun.com/products/jfc/tsc/articles/threads/threads3.html

Similar Messages

  • Open two GUI( JFrame) simultaneously for one application

    Can we open two GUI( JFrame) simultaneously for one application at tha same time.if yes why ?and if no why?

    OK, its really simple, basically, you need a desktop frame to stor all the other frames and then you just pop them in, from a new class each time.
    Here's the code from the demo I learnt it from:
    (The demo itself)
    import javax.swing.JInternalFrame;
    import javax.swing.JDesktopPane;
    import javax.swing.JMenu;
    import javax.swing.JMenuItem;
    import javax.swing.JMenuBar;
    import javax.swing.JFrame;
    import javax.swing.KeyStroke;
    import java.awt.event.*;
    import java.awt.*;
    * InternalFrameDemo.java requires:
    * MyInternalFrame.java
    public class InternalFrameDemo extends JFrame
    implements ActionListener {
    JDesktopPane desktop;
    public InternalFrameDemo() {
    super("InternalFrameDemo");
    //Make the big window be indented 50 pixels from each edge
    //of the screen.
    int inset = 50;
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setBounds(inset, inset,
    screenSize.width - inset*2,
    screenSize.height - inset*2);
    //Set up the GUI.
    desktop = new JDesktopPane(); //a specialized layered pane
    createFrame(); //create first "window"
    setContentPane(desktop);
    setJMenuBar(createMenuBar());
    //Make dragging a little faster but perhaps uglier.
    desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
    protected JMenuBar createMenuBar() {
    JMenuBar menuBar = new JMenuBar();
    //Set up the lone menu.
    JMenu menu = new JMenu("File");
    menu.setMnemonic(KeyEvent.VK_D);
    menuBar.add(menu);
    //Set up the first menu item.
    JMenuItem menuItem = new JMenuItem("New");
    menuItem.setMnemonic(KeyEvent.VK_N);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(
    KeyEvent.VK_N, ActionEvent.ALT_MASK));
    menuItem.setActionCommand("New");
    menuItem.addActionListener(this);
    menu.add(menuItem);
    //Set up the second menu item.
    menuItem = new JMenuItem("Quit");
    menuItem.setMnemonic(KeyEvent.VK_Q);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(
    KeyEvent.VK_Q, ActionEvent.ALT_MASK));
    menuItem.setActionCommand("Quit");
    menuItem.addActionListener(this);
    menu.add(menuItem);
    return menuBar;
    //React to menu selections.
    public void actionPerformed(ActionEvent e) {
    if ("New".equals(e.getActionCommand())) { //new
    createFrame();
    } else { //quit
    quit();
    //Create a new internal frame.
    protected void createFrame() {
    MyInternalFrame frame = new MyInternalFrame();
    frame.setVisible(true); //necessary as of 1.3
    desktop.add(frame);
    try {
    frame.setSelected(true);
    } catch (java.beans.PropertyVetoException e) {}
    //Quit the application.
    protected void quit() {
    System.exit(0);
    * Create the GUI and show it. For thread safety,
    * this method should be invoked from the
    * event-dispatching thread.
    private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);
    //Create and set up the window.
    InternalFrameDemo frame = new InternalFrameDemo();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Display the window.
    frame.setVisible(true);
    public static void main(String[] args) {
    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    Myinternalframe.java:
    import javax.swing.JInternalFrame;
    import java.awt.event.*;
    import java.awt.*;
    public class MyInternalFrame extends JInternalFrame {
    static int openFrameCount = 0;
    static final int xOffset = 30, yOffset = 30;
    public MyInternalFrame() {
    super("Document #" + (++openFrameCount),
    true, //resizable
    true, //closable
    true, //maximizable
    true);//iconifiable
    //...Create the GUI and put it in the window...
    //...Then set the window size or call pack...
    setSize(300,300);
    //Set the window's location.
    setLocation(xOffset*openFrameCount, yOffset*openFrameCount);
    You should be able to tell from that

  • The problem about multi-thread in java application

    i have problem with the multi-thread in java application, i don't know how to stop and restart a thread safely, because the function thread.stop(),thread.suspend() are both deprecated.
    now what i can only do is making the thread check a flag(true or false) to determine whether to start or to stop, but i think this thread will always be in the memory and maybe it will lower the performance of the system, as the program i am developping is working under realtime enviorement.
    please help me about it. thanks !

    hi,
    you can stop a thread by exiting it's run()-method which in terms can be done by checking the interrupted-flag:
    public void run(){
    while(interrupted()){ //if the thread consists of a loop
    or
    public void run(){
    if(interrupted())return;
    if(interrupted())return;
    or by the use of the return-statement anywhere withing the run-method. Afterwards, that is when the thread is no longer needed, you clear all the references to the specific thread object by setting them to null:
    Thread t;
    ... //working
    t.interrupt(); //interrupting
    while(t.isAlive()){
    Thread.yield(); //wait till thread t has stopped
    t=null;
    best regards, Michael

  • Are threads in the application server preemptive?

    Are threads in the application server preemptive or non-preemptive? That is do
    they automatically yield to other threads running in the application server after
    they have run for a certain amount of time or do they only yield when certian
    points in the code are reached (eg when they have completed, when they reach a
    remote call or when they explictly call yield()).

    Green threads (way back in 1.1.8 and so on) was Unix only, and non-preemptive.
    It was also very lumpy and unreliable. Old threading tutorials used to recommend
    calling yield() and suitable points in your code - just like Windows 3.0 all over
    again.
    But all current JVM implementations use OS threading, and are pre-emptive (but
    of course that doesn't stop them being blocked due to synchronization or I/O etc...)
    simon.
    Rob Woollen <[email protected]> wrote:
    It would depend on the underlying JVM or OS. However I've not aware
    of any Java
    implementations that are non-preemptive.
    -- Rob
    Ash Beitz wrote:
    Are threads in the application server preemptive or non-preemptive?That is do
    they automatically yield to other threads running in the applicationserver after
    they have run for a certain amount of time or do they only yield whencertian
    points in the code are reached (eg when they have completed, when theyreach a
    remote call or when they explictly call yield()).

  • Closing all JFrames without killing the application

    Is there a way I can close all JFrames without quiting the application? I have several JFrames open that I want to dispose of at the same time. Is this possible?

    If you close all the JFrames, then how does the user
    interact with the application?I think that's outside the scope of the original question, but there are a number of possibilities. To name just a few:
    1) The console
    2) The program opens a new JFrame after some time has elapsed (maybe an appointment reminder application, or an instant messenger client, for example)
    3) The program is really a server, so you don't need to see anything
    4) The program is "spyware" so it's meant to be hidden
    5) The program runs in full-screen mode part of the time (for example, a game which uses JFrames to choose options, then full-screen for game play)
    ...

  • 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

  • Graphics object of two JFrames in a single application

    Hi,
    I am trying to pop up two JFrames in a Java application, which are supposed to display different things(both have Jpanels to do so). However, I think that the same Graphics object is getting passed around, because the contents from the first JFrames's Jpanel is getting superimposed on the other's! I have tried explicity to insert a 'this.getGraphics()' in all the paints and then use those Graphics objects for drawing purposes, but that has not solved the problem yet!
    Any suggestions on what needs to be done?? Unfortunately, the code is too much to paste here:)
    Thanks!!!

    However, I think that the same Graphics object is getting passed aroundI doubt this. If you are override paint(..) or paintComponent(...) methods then you have a bug in your code. There is no need to explicitly insert a this.getGraphics(..) in your code.
    Maybe you are trying to use the same panel in two frames. This is not allowed.

  • Running threads in webdynpro applications

    Hi all,
    We have a requirement to monitor certain conditions and trigger mails accordingly.This monitoring should be on a daily basis.My question is can we run threads in webdynpro applications.
    Please help me.
    Regards,
    Rohit.

    Hi Rohit,
    TimedTrigger UI element automatically and periodically triggers an event with a specified delay. The TimedTrigger UI element is not displayed on the user interface.
    You can use it for your need.
    Rgds,
    Vilish

  • Is there any way to limit the number of Threads running in Application(JVM)

    Hello all,
    is there any way to limit the number of Threads running in Application(JVM)?
    how to ensure that only 100 Threads are running in an Application?
    Thanks
    Mohamed Javeed

    You should definitely use a thread pool for this. You can specify maximum number of threads that can be run. Be note that the thread pool will only limit the number of threads that are submitted to it. So donot call "Thread"s start() method to start thread on your own. Submit it to the pool. To know more, study about executor service and thread pool creation. Actually it will not be more than 20 line code for a class and you might need maximum of 2 such classes, one for threadPool and other one for rejection handler (if you want).
    Just choose the queue used carefully, you just have to pass it as a parameter to the pool.
    You should use "Bounded" queue for limiting threads, but also be careful in using queues like SynchronizedQueue as the queue will execute immediately the threads submitted to it if maximum number of threads have not been running. Otherwise it will reject it and you should use rejection handler. So if your pool has a synchronized queue of size 100, if you submit 101th thread, it will be rejected and is not executed.
    If you want some kind of waiting mechanism, use something like LinkedBlockingQueue. What this will do is even if you want 100 threads, you can specify the queue's size to be 1000, so that you can submit 1000 threads, only 100 will run at a time and the remaining will wait in the queue. They will be executed when each thread already executing will complete. Rejection occurs only when the queue oveflows.

  • How to add a JMenubar and a JTable in a JFrame in a single application

    Hi all,
    I require an urgent help from you.I am a beginer in programming Swing.I want to add a menu,combobox,and a table in a single application.I did coding as below:
    package com.BSS;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    public class newssa extends JFrame
         public JMenuBar menuBar;
         public JToolBar toolBar;
         public JFrame frame;
         private JLabel jLabel1;
         private JLabel jLabel2;
         private JLabel jLabel3;
         private JLabel jLabel4;
         private JLabel jLabel5;
         private JLabel jLabel6;
         private JComboBox jComboBox1;
         private JComboBox jComboBox2;
         private JComboBox jComboBox3;
         private JComboBox jComboBox4;
         private JComboBox jComboBox5;
         private JComboBox jComboBox6;
         private JTable jTable1;
         private JScrollPane jScrollPane1;
         private JPanel contentPane;
         public newssa()
              super();
              initializeComponent();
              this.setVisible(true);
         private void initializeComponent()
              jLabel1 = new JLabel();
              jLabel2 = new JLabel();
              jLabel3 = new JLabel();
              jLabel4 = new JLabel();
              jLabel5 = new JLabel();
              jLabel6 = new JLabel();
              jComboBox1 = new JComboBox();
              jComboBox2 = new JComboBox();
              jComboBox3 = new JComboBox();
              jComboBox4 = new JComboBox();
              jComboBox5 = new JComboBox();
              jComboBox6 = new JComboBox();
              frame=new JFrame();
              //Included here
              JMenuBar menuBar = new JMenuBar();
              JMenu general = new JMenu("General");
         menuBar.add(general);
         JMenu actions =new JMenu("Actions");
         menuBar.add(actions);
         JMenu view=new JMenu("View");
         menuBar.add(view);
         JMenu Timescale=new JMenu("TimeScale");
         menuBar.add(Timescale);
         Timescale.add("Today CTRL+D");
         Timescale.add("Current Week CTRL+W");
         Timescale.add("Current Month CTRL+M");
         Timescale.add("Current Quarter CTRL+Q");
         Timescale.add("Current Year CTRL+Y");
         Timescale.add("Custom TimeScale CTRL+U");
         JMenu start=new JMenu("Start");
         menuBar.add(start);
         JMenu options=new JMenu("Options");
         menuBar.add(options);
         JMenu help=new JMenu("Help");
         menuBar.add(help);
         JFrame.setDefaultLookAndFeelDecorated(true);
         frame.setJMenuBar(menuBar);
         frame.pack();
         frame.setVisible(true);
         toolBar = new JToolBar("Formatting");
         toolBar.addSeparator();
              //Before this included new
              String columnNames[] = { "ColorStatus", "Flash", "Service Order","Configuration","Configuration Description"};
              // Create some data
              String dataValues[][] =
                   { "blue", "flash", "ORT001" },
                   { "AVCONF", "av configuration with warrenty"}
              // Create a new table instance
              //jTable1 = new JTable( dataValues, columnNames );
              jTable1 = new JTable(dataValues,columnNames);
              jScrollPane1 = new JScrollPane(jTable1);
              contentPane = (JPanel)this.getContentPane();
              //scrollPane = new JScrollPane( table );
              //topPanel.add( scrollPane, BorderLayout.CENTER );
              // jLabel1
              jLabel1.setText("Service Centers");
              // jLabel2
              jLabel2.setText("Service Areas");
              // jLabel4
              jLabel3.setText("Skills");
              jLabel4.setText("Availablity Types");
              // jLabel5
              jLabel5.setText("From Date");
              // jLabel6
              jLabel6.setText("To");
              // jComboBox1
              jComboBox1.addItem("Coimbatore");
              jComboBox1.addItem("Chennai");
              jComboBox1.addItem("Mumbai");
              jComboBox1.addItem("New Delhi");
              jComboBox1.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e)
                        jComboBox1_actionPerformed(e);
              // jComboBox2
              jComboBox2.addItem("North Zone");
              jComboBox2.addItem("South Zone");
              jComboBox2.addItem("Central Zone");
              jComboBox2.addItem("Eastern Zone");
              jComboBox2.addItem("Western Zone");
              jComboBox2.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e)
                        jComboBox2_actionPerformed(e);
              // jComboBox3
              jComboBox3.addItem("Microsoft Components");
              jComboBox3.addItem("Java Technologies");
              jComboBox3.addItem("ERP");
              jComboBox3.addItem("Others");
              jComboBox3.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e)
                        jComboBox3_actionPerformed(e);
              // jComboBox4
              jComboBox4.addItem("One");
              jComboBox4.addItem("Two");
              jComboBox4.addItem("Three");
              jComboBox4.addItem("Four");
              jComboBox4.addItem("Five");
              jComboBox4.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e)
                        jComboBox4_actionPerformed(e);
              // jComboBox5
              jComboBox5.addItem("12/12/2004");
              jComboBox5.addItem("13/12/2004");
              jComboBox5.addItem("14/12/2004");
              jComboBox5.setEditable(true);
              jComboBox5.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e)
                        jComboBox5_actionPerformed(e);
              // jComboBox6
              jComboBox6.addItem("12/11/2004");
              jComboBox6.addItem("13/11/2004");
              jComboBox6.addItem("14/11/2004");
              jComboBox6.setEditable(true);
              jComboBox6.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e)
                        jComboBox6_actionPerformed(e);
              // jTable1
              jTable1.setModel(new DefaultTableModel(4, 4));
              // jScrollPane1
              jScrollPane1.setViewportView(jTable1);
              // contentPane
              contentPane.setLayout(null);
              addComponent(contentPane, jLabel1, 2,29,84,18);
              addComponent(contentPane, jLabel2, 201,33,76,18);
              addComponent(contentPane, jLabel3, 384,32,59,18);
              addComponent(contentPane, jLabel4, 2,77,85,18);
              addComponent(contentPane, jLabel5, 197,79,84,18);
              addComponent(contentPane, jLabel6, 384,80,60,18);
              addComponent(contentPane, jComboBox1, 85,32,100,22);
              addComponent(contentPane, jComboBox2, 276,32,100,22);
              addComponent(contentPane, jComboBox3, 419,30,100,22);
              addComponent(contentPane, jComboBox4, 88,76,100,22);
              addComponent(contentPane, jComboBox5, 276,79,100,22);
              addComponent(contentPane, jComboBox6, 421,78,100,22);
              addComponent(contentPane, jScrollPane1, 33,158,504,170);
              // newssa
              this.setTitle("SSA Service Scheduler");
              this.setLocation(new Point(0, 0));
              this.setSize(new Dimension(560, 485));
         /** Add Component Without a Layout Manager (Absolute Positioning) */
         private void addComponent(Container container,Component c,int x,int y,int width,int height)
              c.setBounds(x,y,width,height);
              container.add(c);
         // TODO: Add any appropriate code in the following Event Handling Methods
         private void jComboBox1_actionPerformed(ActionEvent e)
              int index = jComboBox1.getSelectedIndex();
              switch(index)
                   case 0: System.out.println("Area Coimbatore Selected "); break;
                   case 1: System.out.println("Area Chennai selected"); break;
                   case 2: System.out.println("Mumbai being selected"); break;
                   case 3: System.out.println("New Delhi being selected"); break;
         private void jComboBox2_actionPerformed(ActionEvent e)
              int index = jComboBox2.getSelectedIndex();
              switch(index)
                   case 0: System.out.println("North Zone Selcted "); break;
                   case 1: System.out.println("South Zone being selected"); break;
                   case 2: System.out.println("Central Zone being selected"); break;
                   case 3: System.out.println("Eastern Zone being selected"); break;
                   case 4: System.out.println("Western Zone being selected"); break;
         private void jComboBox3_actionPerformed(ActionEvent e)
              int index = jComboBox3.getSelectedIndex();
              switch(index)
                   case 0: System.out.println("Microsoft Components being selected"); break;
                   case 1: System.out.println("Java Technologies being selected"); break;
                   case 2: System.out.println("ERP Tehnologies being selected"); break;
                   case 3: System.out.println("Other's selected"); break;
         private void jComboBox4_actionPerformed(ActionEvent e)
              int index = jComboBox4.getSelectedIndex();
              switch(index)
                   case 0: System.out.println("One selected"); break;
                   case 1: System.out.println("Two selected"); break;
                   case 2: System.out.println("Three selected"); break;
                   case 3: System.out.println("Four selected"); break;
                   case 4: System.out.println("Five selected"); break;
         private void jComboBox5_actionPerformed(ActionEvent e)
              int index = jComboBox5.getSelectedIndex();
              switch(index)
                   case 0: System.out.println("12/12/2004 being selected"); break;
                   case 1: System.out.println("13/12/2004 being selected"); break;
                   case 2: System.out.println("14/12/2004 being selected"); break;
         private void jComboBox6_actionPerformed(ActionEvent e)
              int index = jComboBox6.getSelectedIndex();
              switch(index)
                   case 0: System.out.println("12/11/2004 being selected"); break;
                   case 1: System.out.println("13/11/2004 being selected"); break;
                   case 2: System.out.println("14/11/2004 being selected"); break;
         public static void main(String[] args)
              newssa ssa=new newssa();
              //JFrame.setDefaultLookAndFeelDecorated(true);
              //JDialog.setDefaultLookAndFeelDecorated(true);
              //JFrame frame = new JFrame("SSA Service Scheduler");
    //frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //frame.setJMenuBar(ssa.menuBar);
    //frame.getContentPane( ).add(ssa.toolBar, BorderLayout.NORTH);
    //frame.getContentPane( ).add(ssa.pane, BorderLayout.CENTER);
    //frame.pack( );
    //frame.setVisible(true);
              try
                   //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
                   UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
              catch (Exception ex)
                   System.out.println("Failed loading L&F: ");
                   System.out.println(ex);
    But as a O/P ,I am getting menu in a seperate windos and the rest of the combobox and jtable in a seperate window.Kindly help me to solve the application.
    VERY URGENT PLEASE..
    Thanks in advance
    with kind regds
    Satheesh.K

    But did u mean this as the next problem,Which I will come across..Yes, the second setVisible(true) seemed to be producing a smaller frame behind the main frame.
    And your JMenuBar is declared twice, but not sure if this will affect the code - haven't read it all.

  • Joining separate threads in different application instances

    Is there any way to have a thread running on a machine that will pick up any new request?
    If application A is running all day on a server, can I start another instance via command line
    that will join that 1st thread/queue, to use it resources, like a connection pool?
    Is that just a servlet with a wider scope?

    What you are talking about really is starting an application in JVM A, and then running a small auxiliary command in JVM B that communicates with A and tells it to start another thread to perform some task. The communications part of this is done with sockets, RMI, etc, and the threading part is done with a Thread, or the services in java.util.concurrent.

  • How to make JFrame ToFront to all applications

    HI
    My problem is i have a JFrame where in i have a JCheckBock and when i check it my frame should be top from all applications opened(like MS Word,notepad or any window) and when it is dechecked it should be back when any application is opened . I tried in solaris by using toFront() but no result is found any suggestions please...

    You should use JLayeredPane as container of your objects. It has a method called "setLayer", or similar, through which you can assign Z-Order to the objects contained in it.
    See the JDK Documentation on "JLayeredPane" topic.

  • Stuck thread in adf application with weblogic

    hi every body
    I am working in JDev 11.1.1.4 and weblogic 10.3.4
    when I deploy my Application in my production weblogic
    after some time (it does not constant it is variable) I got warnning on the server
    when I check the server I got some stuck thread
    any idea or notes how can I know what is the reason of these stuck threads?
    is there any objects have thread unsafe issue, resource contention or race condition in ADF?
    BR,
    Alaa

    actully I do that guys
    but what I get does not have any related to my application
    even those http request does not request the same page
    this is the stuck thread when I dump
    "[STUCK] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'" id=61 idx=0xe8 tid=13369 prio=1 alive, waiting, native_blocked, daemon
    -- Waiting for notification on: oracle/adfinternal/controller/util/RequestLock@0x88e06b58[fat lock]
    at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native Method)
    at jrockit/vm/Locks.wait(Locks.java:1973)[inlined]
    at java/lang/Object.wait(Object.java:485)[inlined]
    at oracle/adfinternal/controller/util/RequestLock.lock(RequestLock.java:42)[inlined]
    at oracle/adfinternal/controller/state/RootViewPortContextImpl.lockViewPortRequestLock(RootViewPortContextImpl.java:604)[optimized]
    ^-- Lock released while waiting: oracle/adfinternal/controller/util/RequestLock@0x88e06b58[fat lock]
    at oracle/adfinternal/controller/state/ControllerState.initializeRequest(ControllerState.java:833)[inlined]
    at oracle/adfinternal/controller/state/ControllerState.initializeRequest(ControllerState.java:754)[inlined]
    at oracle/adfinternal/controller/application/AdfcConfigurator.beginRequest(AdfcConfigurator.java:50)[optimized]
    at org/apache/myfaces/trinidadinternal/config/GlobalConfiguratorImpl._startConfiguratorServiceRequest(GlobalConfiguratorImpl.java:562)[inlined]
    at org/apache/myfaces/trinidadinternal/config/GlobalConfiguratorImpl.beginRequest(GlobalConfiguratorImpl.java:212)[optimized]
    at org/apache/myfaces/trinidadinternal/webapp/TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:155)[optimized]
    at org/apache/myfaces/trinidad/webapp/TrinidadFilter.doFilter(TrinidadFilter.java:92)[optimized]
    at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:56)[optimized]
    at oracle/adf/library/webapp/LibraryFilter.doFilter(LibraryFilter.java:175)[optimized]
    at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:56)[optimized]
    at oracle/security/jps/ee/http/JpsAbsFilter$1.run(JpsAbsFilter.java:111)[optimized]
    at jrockit/vm/AccessController.doPrivileged(AccessController.java:254)[inlined]
    at oracle/security/jps/util/JpsSubject.doAsPrivileged(JpsSubject.java:313)[inlined]
    at oracle/security/jps/ee/util/JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)[inlined]
    at oracle/security/jps/ee/http/JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)[inlined]
    at oracle/security/jps/ee/http/JpsAbsFilter.doFilter(JpsAbsFilter.java:161)[optimized]
    at oracle/security/jps/ee/http/JpsFilter.doFilter(JpsFilter.java:71)[optimized]
    at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:56)[optimized]
    at oracle/dms/servlet/DMSServletFilter.doFilter(DMSServletFilter.java:136)[optimized]
    at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:56)[optimized]
    at weblogic/servlet/internal/RequestEventsFilter.doFilter(RequestEventsFilter.java:27)[optimized]
    at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:56)[inlined]
    at weblogic/servlet/internal/WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)[inlined]
    at weblogic/servlet/internal/WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)[optimized]
    at weblogic/security/acl/internal/AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)[optimized]
    at weblogic/security/service/SecurityManager.runAs(SecurityManager.java:120)[inlined]
    at weblogic/servlet/internal/WebAppServletContext.securedExecute(WebAppServletContext.java:2277)[inlined]
    at weblogic/servlet/internal/WebAppServletContext.execute(WebAppServletContext.java:2183)[optimized]
    at weblogic/servlet/internal/ServletRequestImpl.run(ServletRequestImpl.java:1454)[optimized]
    at weblogic/work/ExecuteThread.execute(ExecuteThread.java:207)[optimized]
    at weblogic/work/ExecuteThread.run(ExecuteThread.java:176)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace
    any another ideas?
    BR,
    Alaa

  • Oraclient9i.dll error in multi threaded delphi server application

    I created a multi threaded server application in delphi using oracle9i and indy server components. When I run my application, I am getting an error "oraclient9i.dll" error when executing my SQL statements. I have check communication between my server application and the client application without using oracle and its working fine, its only when I started executing SQL statements when I got this error.
    Can anybody help me with this problem or point me to the right direction on how to resolve this issue.
    thanks

    > I have tried what you suggested. I have created a
    seperate TOracleSession on each thread that I create
    on the OnConnect event however I am having Problems
    using the oraclesession created on the OnExecute
    event. Somehow it is still executing the SQL that I
    have created on the main form where I first opened an
    oraclesession component created on the main form.
    It sounds then like the TOracleSession object in the thread is a copy of the one in the main thread/form.
    > Do you think that It would work if I create an
    instance of the TOracleDatasets and TOracleQuery on
    the OnExecute event and also at the same time create
    my TOracleSession on this event and continue
    processing the data receive from the client server.
    I've never used the Indy components for threading. The default TThread class worked just fine for me.
    What I used to do is define the session and database objects as privates in my new thread class (let's call it TThreadSQL) - which was subclassed from TThread.
    The constructor of this new TThreadSQL class did the following (writing here purely from memory - have not done Delphi for some time now): constructor TThreadSQL.Create( TNSalias, username, password : string );
    // constructor is called with the Oracle session connection details
    begin
      inherited Create; // call the parent class constructor
      CreateOracleSession; // call own private method to create an Oracle connection
    end;
    The CreateOracleSession method would then:
    - create a BDE Session (TSession) object
    - create a BDE Database (TDatabase) object, using the BDE Oracle native driver and an Oracle TNS alias plus username and password for connection
    The destructor would close the connection. The Execute method which is used to fire up the thread, would use a TQuery object (or whatever) to execute a SQL using it owns connection.

  • Thread-Safe BC4J Application

    Hello,
    I have an BC4J-based application, based on BC4J9.0.2. I'm considering to upgrade my BC4J library to upper version to make my application more thread-safe.
    How can I make thread-safe application using BC4J? Is there any specific Rule?
    Thank you.

    Hi,
    Its hard to define a single rule since it depends upon how each application is using threads. I have included some thoughts about the most common scenarios for web clients below:
    The BC4J client wizards (datatags, struts, JClient) will help you generate threadsafe applications. The general rule when writing a web client is to ensure that each "user", as represented by an HttpSession instance, has their own ApplicationModule instance. Using the ApplicationModule datatag or the BC4J/Struts framework will guarantee this.
    Beyond this it may also be necessary to coordinate multiple concurrent requests from a single client (imagine a user pounding on the browser refresh button). One approach for solving this problem is to synchronize requests on some sort of session context. The ApplicationModule tag supports a latching mode (see the lock attribute) which performs this by synchronizing access to the SessionCookie (cached in session, used to acquire ApplicationModule instance). Support for latching will also be available in Struts in the 9.0.3.3 and later timeframe.
    Hope this helps,

Maybe you are looking for

  • Creative Zen Vision M not fully charging

    (Creative Zen Vision M not fully charging( Hi, I recently bought a refurbished ZVM that doesnt seem to charging properly. When I first got it, it hadnt been charged in quite some time so the battery was overdead. My PC couldnt detect it when I connec

  • Officejet pro 8500A connected via wireless, but not accessible....

    I can t access my officejet pro printer via wifi, after a firmware upgrade last week. I can print however from my iPad, but not from my laptop. Both are connected to the same wireless signal. I can see in my printer and router that both are connected

  • Set font color for the JTextField

    I'm using JTextField in my project. However, can anybody teach me how to set the font color for the font in the JTextField to other color. The default font color is black. Any idea about this?

  • How do I increase Memory in Final Cut Pro 7 (Revised)

    I realize I didn't give enough information on what led to the "Error: Out of Memory" message. I started out with 3 mp4s shot at 25fps in PAL with a camcorder.  Through MPEG Streamclip I converted them to .mov files: Frame size 640x360, Pixel: square,

  • Can I Save plug ins & add ons for next Format & Reload

    I Wish to save Add On's & Plug In's to save me looking for them next time I format & reload my Pc again?