Jvm unnamed windows events handle leak 1.3.1_08-b03 - 1.4.2-b28

Hello,
I have an server application that leaks windows unnamed event handles on small loads. (200 network connections) I've used the process explorer from www.sysinternals.com to find the type of handles that where leaking. I've run my application through jprobe several times and i'm not leaking any java objects. it doesn't happen on every run. It can run about 5 to 10 times with no leak but as i continue running a request that has 200 network connnections it will leak one handle. Over time they add up memory increases and eventually we get a out of memory error and the server has to be restarted
My application uses the following
java version "1.3.1_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_08-b03)
Java HotSpot(TM) Client VM (build 1.3.1_08-b03, mixed mode)
windows server 2000 service pack 3 (I've tried sp1 and sp2 same issue)
starting and stopping threads
inet jdbc driver una2000
zlib compression libraries
encryption DES
sockets
no jni code
My network code uses input.available() and Socket.setSoTimeout() I don't think the setSoTimeOut time is timing anything out on these small runs.
I've also have run it with
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
I've tried not stopping any threads from my thread pool and it made no change. It still leaks! :-(
Does anyone know what creates the unamed event handles? Are they created by synchronization? Since my applications uses so many different api's it's like looking for a needle in a hay stack.
p.s. I've been working on this problem on and off for about 1 month. I've search the java forums and google.
Thanks
Alexander Anguiano

My message has been here for a while and is off the first page. :-( Oh, well. I thought I would update this just incase anyone was following it. (can I award my self those duke dollars?)
I think i've found the problem of why we are leaking handles. In the first 10 minutes it leaked 3 handles.(they may not have leaked but are resource that our application needed because of all the lazy initialization that we do) I've been runing a 200 task request every 5 minutes for the last 6 hours and have not leak any handles. The problem appears to be with calls to socket.setSoTimeout. I set it to 0. This effectively tells the socket to never time out. This is not an acceptable solution to the problem. I will be working on that next.
Has any one had problems with the socket.setSoTimeout?
If not then it may have to do with our simulated select. We have one thread that handles connection. Once the connection is established it's put on a list that get's polled [input.available()] that is handled by thread 2 if there is data then it gets handled by a worker thread [thread n-12]. Once the worker thread has read up to 4K of data it is put back on thread 2. I'm thinking that it has to do with so many thread doing a little work on it.

Similar Messages

  • Window event handling

    I am a seasoned windoze programmer and can do this quite easily. However, I am very new to Java and it doesn't seem to be as easy. There MUST be a way to do this; I am sure I just am not seeing it:
    I want to trap for window events BEFORE they occur. Specifically, I want to hijack the event WindowEvent.WINDOW_ICONIFIED and prevent it from being processed. Setting up a window listener and implementing windowIconified() is useless to me as that happens after the window has been iconified. I want to PREVENT the window from being ICONIFIED.
    I am forced to use JRE 1.2 so I cannot use setUndecorated(true);
    I looked at some of the Java source code and it looks like not all events can be consumed. It looks as if no window events can be consumed. Is this true? If they can, how would you go about consuming a window event?
    I have literally spent days trying to figure a way to do this. Does anyone have any ideas here?
    Thanks,
    - Brownie

    I dont have any idea. Perhaps you should post it in Advanced Language Topics or Project Swing. People seldom browse this forum I think.
    I guess Java won't have a way to do it, though. I doubt its portablility(thinking about Window Manager from X world). Not very sure about it.

  • First time data is not transported to pop up window through event handler

    Hi all,
    I am using NWDS 7.0, Now I want to open a pop up on click of a action link.
    There are two DCs DC-A and DC-B.
    I am calling action from DC-A to DC-B. DC-B contains view of pop up window.
    In DC-A I am using intreface controller of DC-B by using used coponents.
    Now In the DC-B used components I have created one fireplugin which is connected ith pop up view of DC-B and that firplugin is called from DC-A action to transport data from Dc-A to DC-B.
    Problem : when I click first time to open pop-up window then event handler is not called but the windows opened. When I close that window and again open the transported data start displaying on pop up window.
    So can you please help me that why first time data is not transported to pop up window.
    Thanks
    Kaushal

    You'll need to use an OARawTextBean. Oracle doesn't support opening links in new windows using OAFormattedTextBean. Just be aware that you'll need to set the CSS class in the HTML as well if you need it formatted a certain way.

  • Error in event handler method in window

    Hi,
    I have created configuration in SEFVISU, to receive the workitem i have created a parameter in event handler method in window
    but it is throwing dump The ASSERT condition was violated, if i remove that parameter means application executing properly but i am not able to pass the unique, values please guide me.
    Regards,
    Srini.

    Hello Srini,
    are you talking about the default event handler method of the window? if so then you need to ensure that the parameter name defined in the event and passed in name are same. And also its better to go for the parameter type as STRING.
    other option would be instead of defining the static parameters in the event handler method, you can get the parameters from the WDEVENT itself by accessing WDEVENT->PARAMETERS table.
    hope this helps.
    BR, Saravanan

  • New window in event handling

    hi to all
    i m beginner in java programming and i want to do event handling on mouse click. i have a button and i want if i click that button a new window open
    can anyone help me

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ActionEvents implements ActionListener
        JDialog dialog;
        public ActionEvents(JFrame f)
            dialog = new JDialog(f, "dialog");
            dialog.getContentPane().add(new JLabel("hello world", JLabel.CENTER));
            dialog.setSize(200,100);
            dialog.setLocation(425,200);
        public void actionPerformed(ActionEvent e)
            if(!dialog.isVisible())
                dialog.setVisible(true);
            else
                dialog.toFront();
        private JPanel getPanel()
            JButton button = new JButton("open dialog");
            button.addActionListener(this);
            JPanel panel = new JPanel();
            panel.add(button);
            return panel;
        public static void main(String[] args)
            JFrame f = new JFrame();
            ActionEvents ae = new ActionEvents(f);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(ae.getPanel(), "North");
            f.setSize(200,100);
            f.setLocation(200,200);
            f.setVisible(true);
    }

  • Event Handling - Swing Window to Console Switch

    I have a serious problem with an app I am writing - I have a swing 'main menu' system built around a standard JFrame which calls a new instance of another class. This other class takes input from the keyboard and is displayed in the standard console window; i.e Using the standard System.out.print() syntax.
    My problem is the Swing window will not release the input stream to allow the conole to take input from the keyboard. I have implemented inner-classes within the 'main menu's' class for event handling purposes; in this case the mouse-clicks of the menu's JButton components. The problem only manifests itself when the inner-class' event handling code is called - I wrote some test methods to call the console classes code without using the inner-class' and the console works perfectly. It is my conclusion, therefore, that the calling of the console-based method from within the inner-class of the Swing super-class reserves the input for the Swing components, failing to reactivate the console. I have tried creating new InputStream objects but to no avail.
    Does anyone know how to release or terminate the methods within the inner-classes (they are all void / no return type as they implement the ActionListener abstract class)? This, I hope, will return the focus to the console.
    Any advice would be most greatfully received.
    LEC.

    If you were to have your connection object declared so that it could be referenced from anywhere in your class then you could use it in you actionPerformed method. For example:
    public class Test extends JFrame
    &nbsp&nbsp&nbspprivate Connection con = null;
    &nbsp&nbsp&nbsppublic void actionPerformed(ActionEvent e)
    &nbsp&nbsp&nbsp{
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbspMyDetails appmydet = new MyDetails(con, id); //connection, userID
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbspappmydet.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
    &nbsp&nbsp&nbsp}
    &nbsp&nbsp&nbsppublic void setConnection(Connection theCon)
    &nbsp&nbsp&nbsp{
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbspcon = theCon;
    &nbsp&nbsp&nbsp}

  • Event handling operation on other software windows

    Hi friends
    I am able to execute another external program through java code using
    Runtime.getRuntime().exec();
    But now I want to perform Event Handling operation on such a opened external program(software) window.
    Is it possible in Java to perform Event Handling operation on other software windows.
    Thanks

    Can anybody give me some idea. I already gave you hte idea. I told you to write the C++ code to do it. There is no other way. You cannot do that from Java.
    WRT the sockets post:
    whether you use JNI or sockets: the accessing code will still not be written in Java. Hence you still can't do it in Java.

  • Opening a new window from an event handler in IC WebUI

    Hello ,
    I want to open a new browser window on the click of a button (through the event handler) .This can be done using javascript ,but I ideally want it to be triggered from the event handler .The URL is dynamically
    generated . Please do let me know if there are ways to achieve this .

    Hi,
    In the place where you declare your button write this code.
        ls_button-id = xx.
        lv_string1 = 'javascript:window.open( "'.
        lv_string2 = '" );'.
        ls_button-on_client_click = 'javascript:window.open( "lv_url");'
        CONCATENATE lv_string1
                    lv_url
                    lv_string2
                    INTO lv_string3.
        ls_button-on_client_click = lv_string3.
        ls_button-enabled = abap_true.
        APPEND ls_button TO gt_editbutton.
    pass your dynamic URL here to lv_url. Dont Pass anything to ls_button-on_click.
    You can do this coding in DO_PREPARE_OUTPUT or IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS wherever your button is present.
    Regards,
    Masood Imrani S.

  • Window: close event handler

    I have a button (action="dialog:ADD_MEMBER" useWindow="true" windowEmbedStyle="inlineDocument" windowModalityType="applicationModal" windowHeight="600" windowWidth="700"), which open a new window in the same TaskFlow. This window can be closed by using the special (my af:commandButton) button and by using common window close button ('X'). I want to write my custom close event handler in the second case. How can I do it?

    Hi,
    don't think you can. Did you check ifthe return listener fires ?
    Frank

  • Sleutel Bind, fancy key events handler for standalone window managers

    I began using Openbox in my laptop a while ago, and I was amazed by the speed, customization and simplicity it provides. After I started customizing my desktop I noticed that some of the special keys (TouchpadToggle, Volume, PrintScreen, etc) didn't worked at all. There are some applications for the Volume keys to work, but not for keys like touchpad-toggle and print-screen. Of course, there's a workaround for each case using simple scripts, but I wanted something a little more fancy, so I made:
    Sleutel Bind
    It's made in C and provides key events handling for:
    XF86TouchpadToggle
    Print (prtsc key)
    It makes use of libnotify to display states ( touchpad enabled/disabled, screenshot taken, etc) and imlib2 (a very popular library, probably already installed in your system) to grab the screenshots. Almost all other keys are covered already by another application, but if needed, more key events will be added in the future.
    Feel free to post your thoughts about Sleutel Bind, it's my first contribution to the community.
    How to use
    Once installed just run the command as a normal user.
    If using openbox, place the following command in the "~/.config/openbox/autostart" file:
    sleutelb &
    Links
    AUR
    github
    Last edited by DanielRS (2013-03-01 21:58:35)

    mgmillani wrote:
    I believe it must have been a bug and it was fixed, since print screen now works as expected. I'm using xmonad version 0.11-9, with ghc version 7.8.3.
    davama wrote:
    Note: for my print key to be recognized by xev i had to hold the ctrl key. that way it was not registered by xmonad. Also for xev command i use
    xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'
    Nice, that seems to be useful. Thanks!
    @LQYMGT
    Do you still have issues with the latest version? Otherwise I will mark this thread as solved.
    well, still do not work... But I do not want to try it any more...So you can mark.

  • RMI, event handling, and Winow.dispose()

    Hi all,
    If you combine RMI with an event handler and java.awt.Window.dispose(), the JVM hangs. The only way to solve this problem is by disposing of the frame from within SwingUtilities.invokeLater.
    Please check the following code:
    ServerInterface.java:_
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface ServerInterface extends Remote {
        void Send(ClientInterface CI) throws RemoteException;
    ClientInterface.java:_
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface ClientInterface extends Remote {
        void Send() throws RemoteException;
    Server.java:_
    import java.rmi.RemoteException;
    import java.rmi.server.UnicastRemoteObject;
    import java.rmi.Naming;
    public class Server extends UnicastRemoteObject implements ServerInterface {
    public Server() throws RemoteException {}
    public void Send (ClientInterface CI)
    try { CI.Send(); } catch (Throwable t){System.out.println(t);}
    public static void main(String args[])
    try {
          Naming.rebind      ( "rmi://localhost:1099/Testing",new Server() );
          System.err.println ("Server ready");
    catch ( Throwable t )
            System.out.println ( t );
    Client.java:_
    import java.rmi.RemoteException;
    import java.rmi.server.UnicastRemoteObject;
    import java.rmi.Naming;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import javax.swing.SwingUtilities;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JButton;
    public class Client extends UnicastRemoteObject implements ClientInterface,ActionListener {
    static JFrame A=null;
    static ServerInterface ServerSide;
    private Client()  throws RemoteException {}
    public void Send()
    if ( A == null )
         A = Display("Remove");                   // display frame
    else                                // remove frame
         SwingUtilities.invokeLater ( new Runnable(){public void run(){A.dispose();A=null;}} );
    public static void main(String[] args)
    try {
          ServerSide = (ServerInterface) Naming.lookup ( "rmi://localhost:1099/Testing" );
          ServerSide.Send(new Client());
    catch ( Throwable t )
            System.out.println ( t );
    public void actionPerformed(ActionEvent e)
    try { ServerSide.Send(new Client()); } catch (Throwable t){System.out.println(t);}
    private JFrame Display (String label)
    JButton b = new JButton (label);
    b.addActionListener(this);
    JPanel p = new JPanel ();
    p.add (b);
    JFrame frame = new JFrame ();
    frame.getContentPane().add(p);
    frame.pack();
    frame.setVisible(true);
    return frame;
    }You can do any GUI work from within an event handler, only when you try to dispose of a frame, the system hangs !!!

    Thank you for responding to my problem.
    unless their documentation says otherwise (eg: repaint). I checked the API for "repaint()", but it didn't mention anything about the EDT. What documentation you are referring to ?
    What I don't understand is that why "dispose()" works well on non-RMI systems and hangs the machine on RMI systems ? It even works fine on RMI system providing that you are not disposing of the frame from within an event handler. So the problem occurs only if you are combining the three elements: RMI, event handler, and dispose().
    Conversely, you should avoid doing anything that may take a long time on the EDT. Perhaps remote methods fall into that category.It is true that we should avoid doing anything that may take a long time on the EDT; however, in this particular example, dispose() is not done through a remote call, it is done on the client where the frame should be removed.
    I also tried disposing of the frame from within a normal Thread (instead of the EDT), and it worked just fine.

  • Registry handles leaked from

    +
    System
    Provider
    [ Name]
    Microsoft-Windows-User Profiles Service
    [ Guid]
    {89B1E9F0-5AFF-44A6-9B44-0A07A7CE5845}
    [ EventSourceName]
    profsvc
    EventID
    1530
    [ Qualifiers]
    32768
    Version
    0
    Level
    3
    Task
    0
    Opcode
    0
    Keywords
    0x80000000000000
    TimeCreated
    [ SystemTime]
    2011-06-11T07:37:12.000Z
    EventRecordID
    127007
    Correlation
    Execution
    [ ProcessID]
    0
    [ ThreadID]
    0
    Channel
    Application
    Computer
    Panther-PC
    Security
    [ UserID]
    S-1-5-18
    EventData
    Detail
    16 user registry handles leaked from \Registry\User\S-1-5-21-1082989139-2594333343-3947924465-1001: Process 2384 (\Device\HarddiskVolume1\Program Files\Common Files\microsoft shared\Windows Live\WLIDSVC.EXE) has opened key \REGISTRY\USER\S-1-5-21-1082989139-2594333343-3947924465-1001
    Process 2384 (\Device\HarddiskVolume1\Program Files\Common Files\microsoft shared\Windows Live\WLIDSVC.EXE) has opened key \REGISTRY\USER\S-1-5-21-1082989139-2594333343-3947924465-1001 Process 2384 (\Device\HarddiskVolume1\Program Files\Common Files\microsoft
    shared\Windows Live\WLIDSVC.EXE) has opened key \REGISTRY\USER\S-1-5-21-1082989139-2594333343-3947924465-1001 Process 2384 (\Device\HarddiskVolume1\Program Files\Common Files\microsoft shared\Windows Live\WLIDSVC.EXE) has opened key \REGISTRY\USER\S-1-5-21-1082989139-2594333343-3947924465-1001
    Process 828 (\Device\HarddiskVolume1\Program Files\NVIDIA Corporation\nTune\nTuneService.exe) has opened key \REGISTRY\USER\S-1-5-21-1082989139-2594333343-3947924465-1001 Process 2384 (\Device\HarddiskVolume1\Program Files\Common Files\microsoft shared\Windows
    Live\WLIDSVC.EXE) has opened key \REGISTRY\USER\S-1-5-21-1082989139-2594333343-3947924465-1001\Software\Microsoft\SystemCertificates\My Process 2384 (\Device\HarddiskVolume1\Program Files\Common Files\microsoft shared\Windows Live\WLIDSVC.EXE) has opened key
    \REGISTRY\USER\S-1-5-21-1082989139-2594333343-3947924465-1001\Software\Microsoft\SystemCertificates\CA Process 2384 (\Device\HarddiskVolume1\Program Files\Common Files\microsoft shared\Windows Live\WLIDSVC.EXE) has opened key \REGISTRY\USER\S-1-5-21-1082989139-2594333343-3947924465-1001\Software\Microsoft\SystemCertificates\Root
    Process 2384 (\Device\HarddiskVolume1\Program Files\Common Files\microsoft shared\Windows Live\WLIDSVC.EXE) has opened key \REGISTRY\USER\S-1-5-21-1082989139-2594333343-3947924465-1001\Software\Microsoft\SystemCertificates\SmartCardRoot Process 2384 (\Device\HarddiskVolume1\Program
    Files\Common Files\microsoft shared\Windows Live\WLIDSVC.EXE) has opened key \REGISTRY\USER\S-1-5-21-1082989139-2594333343-3947924465-1001\Software\Microsoft\SystemCertificates\TrustedPeople Process 2384 (\Device\HarddiskVolume1\Program Files\Common Files\microsoft
    shared\Windows Live\WLIDSVC.EXE) has opened key \REGISTRY\USER\S-1-5-21-1082989139-2594333343-3947924465-1001\Software\Microsoft\SystemCertificates\trust Process 2384 (\Device\HarddiskVolume1\Program Files\Common Files\microsoft shared\Windows Live\WLIDSVC.EXE)
    has opened key \REGISTRY\USER\S-1-5-21-1082989139-2594333343-3947924465-1001\Software\Policies\Microsoft\SystemCertificates Process 2384 (\Device\HarddiskVolume1\Program Files\Common Files\microsoft shared\Windows Live\WLIDSVC.EXE) has opened key \REGISTRY\USER\S-1-5-21-1082989139-2594333343-3947924465-1001\Software\Policies\Microsoft\SystemCertificates
    Process 2384 (\Device\HarddiskVolume1\Program Files\Common Files\microsoft shared\Windows Live\WLIDSVC.EXE) has opened key \REGISTRY\USER\S-1-5-21-1082989139-2594333343-3947924465-1001\Software\Policies\Microsoft\SystemCertificates Process 2384 (\Device\HarddiskVolume1\Program
    Files\Common Files\microsoft shared\Windows Live\WLIDSVC.EXE) has opened key \REGISTRY\USER\S-1-5-21-1082989139-2594333343-3947924465-1001\Software\Policies\Microsoft\SystemCertificates Process 2384 (\Device\HarddiskVolume1\Program Files\Common Files\microsoft
    shared\Windows Live\WLIDSVC.EXE) has opened key \REGISTRY\USER\S-1-5-21-1082989139-2594333343-3947924465-1001\Software\Microsoft\SystemCertificates\Disallowed
    should i be worried or can i get some help with this ?

    I'm having the same problem on one of work's Server 2008 R2 machines, but the software causing the leaks are the Microsoft Windows programs
    cmd.exe
    robocopy.exe
    conhost.exe
    Microsoft can you please stop your software from leaking, thank you.
    From the event viewer
    Windows detected your registry file is still in use by other applications or services. The file will be unloaded now. The applications or services that hold your registry file may not function properly afterwards.  
     DETAIL -
     6 user registry handles leaked from \Registry\User\S-1-5-21-3799963273-679199981-738785089-500:
    Process 2348 (\Device\HarddiskVolume2\Windows\System32\cmd.exe) has opened key \REGISTRY\USER\S-1-5-21-3799963273-679199981-738785089-500
    Process 6532 (\Device\HarddiskVolume2\Windows\System32\Robocopy.exe) has opened key \REGISTRY\USER\S-1-5-21-3799963273-679199981-738785089-500
    Process 2348 (\Device\HarddiskVolume2\Windows\System32\cmd.exe) has opened key \REGISTRY\USER\S-1-5-21-3799963273-679199981-738785089-500\Software\Microsoft\Windows NT\CurrentVersion
    Process 2348 (\Device\HarddiskVolume2\Windows\System32\cmd.exe) has opened key \REGISTRY\USER\S-1-5-21-3799963273-679199981-738785089-500\Control Panel\International
    Process 6700 (\Device\HarddiskVolume2\Windows\System32\conhost.exe) has opened key \REGISTRY\USER\S-1-5-21-3799963273-679199981-738785089-500\Control Panel\International
    Process 6532 (\Device\HarddiskVolume2\Windows\System32\Robocopy.exe) has opened key \REGISTRY\USER\S-1-5-21-3799963273-679199981-738785089-500\Control Panel\International

  • Handle leak

    Why does each iteration of this code leak 4 handles? Is there some other statement that must be issued to cleanup the Oracle connection completely?
    The program was run from Jdeveloper 9.0.3.10.35 using Oracle Client 9.2.0.1.0.
    package mypackage3;
    import sqlj.runtime.*;
    import sqlj.runtime.ref.*;
    import java.sql.*;
    import oracle.sqlj.runtime.*;
    import sqlj.runtime.ref.DefaultContext;
    public class connTest
    public connTest()
    public static void main(String[] args) throws InterruptedException
    Date currentDateTime;
    while (true) {
    try {
    Oracle.connect("jdbc:oracle:oci8:@dbname", "user", "passwd", false);
    #sql {select sysdate into :currentDateTime from dual};
    catch (SQLException se) {
    System.out.println(se);
    try {
    Oracle.close(DefaultContext.CLOSE_CONNECTION);
    Oracle.connect("jdbc:oracle:oci8:@dbname", "user", "passwd", false);
    catch (SQLException se) {
    System.out.println(se);
    Thread.sleep(5000);
    }

    I'm checking the handle count for the jvm running the program in Task Manager.
    I expect the Oracle.close to clean up so that all resources used by the connection being closed are made available for garbage collection. Also there's no memory leaking I can see - just the handles. I've also tried a code variation that allocates a new defaultContext then after the close sets it to null. That doesn't seem to make any difference. I'll try running that in a 1.4 jvm and see if I can force garbage collection. I suspect that the handle's allocated on the connect aren't being closed in windows land on the Oracle.close. I wouldn't expect the garbage collecter to actually know that the contents of memory are a window's handle and that when that memory is garbage collected a windows call must be made to close the handle.

  • Camera Eventually stops connecting possibly caused by a handle leak

    Can somebody tell me how to write an app that display a picture of the webcam on screen, change the size of video shown and remove it from the screen without the camera eventually not displaying and the created handles being left behind.
    From my investigation any camera with the usbvideo.sys driver is affected, which will be at least 50% of webcams out there.
    Sometimes air locks up and becomes unresponsive / sometimes it just stops displaying the camera, it depends upon the camera.
    Tested with lots of different cameras on Windows 7 and 8 with lots of versions of the Air/Flex Frameworks.
    Heres a simple app to test it.
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx"
        creationComplete="windowedapplication1_creationCompleteHandler(event)">
      <fx:Script>
      <![CDATA[
      import mx.collections.ArrayList;
      import mx.events.FlexEvent;
      import spark.events.IndexChangeEvent;
      private var camera:Camera;
      [Bindable]
      private var cams:ArrayList;
      private var video:Video;
      [Bindable]
      private var autoInProgress:Boolean;
      [Bindable]
      private var totalAttempts:int = 0;
      private var currentAttempts:int = 0;
      protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
      cams = new ArrayList(Camera.names);
      protected function selectedCamera_changeHandler(event:IndexChangeEvent):void
      camera = Camera.getCamera(selectedCamera.selectedIndex.toString());
      if (camera)
      camera.setMode(640, 480, 30);
      private function start() : void {
      currentAttempts = 0;
      autoInProgress = true;
      if (resizeTest.selected) {
      addVideoAndAttachCamera();
      resize();
      else {
      attachDetach();
      private function addVideoAndAttachCamera() : void {
      if (camera) {
      video = new Video(camera.width, camera.height);
      videoContainer.addChild(video);
      video.attachCamera(camera);
      private function detachCameraAndRemoveVideo() : void {
      video.attachCamera(null);
      video.clear();
      videoContainer.removeChild(video);
      video = null;
      private function attachDetach() : void {
      ++ currentAttempts;
      ++ totalAttempts;
      if (camera) {
      addVideoAndAttachCamera();
      memoryUsage.text = "System Memory Usage: " + (System.totalMemory).toString() + "bytes";
      setTimeout(function():void {
      detachCameraAndRemoveVideo();
      if (currentAttempts < int(attempts.selectedItem)) {
      attachDetach();
      else {
      autoInProgress = false;
      }, int(delay.selectedItem));
      private function resize() : void {
      ++ currentAttempts;
      ++ totalAttempts;
      if (camera) {
      camera.setMode(640, 480, 30);
      memoryUsage.text = "System Memory Usage: " + (System.totalMemory).toString() + "bytes";
      setTimeout(function():void {
      if (currentAttempts < int(attempts.selectedItem)) {
      resize();
      else {
      detachCameraAndRemoveVideo();
      autoInProgress = false;
      }, int(delay.selectedItem));
      ]]>
      </fx:Script>
      <s:VGroup>
      <s:HGroup>
      <s:Label enabled="{!autoInProgress}" text="Camera" />
      <s:ComboBox enabled="{!autoInProgress}"
      id="selectedCamera"
      dataProvider="{cams}"
      change="selectedCamera_changeHandler(event)"/>
      <s:Label id="memoryUsage" />
      <s:Label text="{totalAttempts}" />
      </s:HGroup>
      <s:HGroup>
      <s:Label text="Auto Connect/Disconnect" enabled="{!autoInProgress}" />
      <s:ComboBox id="attempts" enabled="{!autoInProgress}" selectedIndex="1">
      <mx:ArrayCollection>
      <fx:String>1</fx:String>
      <fx:String>5</fx:String>
      <fx:String>10</fx:String>
      <fx:String>50</fx:String>
      <fx:String>75</fx:String>
      <fx:String>100</fx:String>
      <fx:String>500</fx:String>
      <fx:String>1000</fx:String>
      <fx:String>5000</fx:String>
      <fx:String>10000</fx:String>
      </mx:ArrayCollection>
      </s:ComboBox>
      <s:Label text="times" enabled="{!autoInProgress}" />
      <s:CheckBox id="resizeTest" label="Resize Test?" />
      <s:Button enabled="{!autoInProgress}" click="start()" label="Start" />
      </s:HGroup>
      <s:HGroup>
      <s:Label text="Delay" enabled="{!autoInProgress}" />
      <s:ComboBox id="delay" enabled="{!autoInProgress}" selectedIndex="1">
      <mx:ArrayCollection>
      <fx:String>1000</fx:String>
      <fx:String>1500</fx:String>
      <fx:String>2000</fx:String>
      <fx:String>3000</fx:String>
      </mx:ArrayCollection>
      </s:ComboBox>
      </s:HGroup>
      <mx:UIComponent id="videoContainer" width="640" height="480" />
      </s:VGroup>
    </s:WindowedApplication>
    The resizeTest checkbox shows that you can make the camera lockup just by repetitively calling cam.setMode().
    I have submitted a bug into the bugbase.  Bug#3850401 - Handle leak with video.attachCamera leading to inoperable camera

    Avrom,
    I have never seeb this error before.
    It certainly looks like an OC4J issue. Please try to get an answer on this in the OC4J forum.
    Steven Davelaar,
    JHeadstart Team.

  • Overriding windowClosing(Window Event e)???

    Hello,
    I have a similar question to some already posted regarding closing frames and panels. I am currently writing an application using Java as the interface an Access as the backend. I have the option to exit through a Jmenu. This allows me to prompt the user to save their changes before closing.
    My problem is I want the user to have the same option when using the X button in the top right hand corner.
    At the minute I am using the code below, which ends the application immediately, without allowing me time to save any changes first.
         fl.addWindowListener(new WindowAdapter()
    public void windowClosing(WindowEvent e)
    System.exit(0);
    Can anyone offer me a better solution; I would ideally like to be able to load a JoptionPane with a YES_NO_OPTION to confirm if to save, followed by a second to confirm Exit, which is how the Jmenu option works.
    Thanks for any help in advance.
    Kris Dowse

    What your code actually does: it intercepts the window is closing event, and as soon as it arrives, it kills the Java Virtual Machine (that's what System.exit() does).
    Instead of the System.exit() call, you should let your option pane to appear. If it's modal (what I think it is), then I'd say you should run it in another thread, because you're supposed to return from an event handling method as soon as possible. The best is if you have a method which is invoked both from the action listener of the File/Exit menu item, and the window closing listener of the JFrame. This method should create a new thread, doing the work inside, and return immediatelly. If the user (inside the new thread) chooses to cancel the exit, then the thread simply stops, and your application runs. If the user chooses to really exit, then just call the System.exit(), that will kill all the active threads and stop the JVM. This is the behaviour you're seeking for, aren't you?
    However, I'd think you also should set the JFrame's setDefaultCloseOperation to DO_NOTHING_ON_CLOSE.

Maybe you are looking for

  • Can not import Verisign certificate

    Dear all, I am trying to import a Verisign certificate in my ABAP BW 3.5 Production system.This is a certificate renewal as I had a certificate there for a year that is to expire on the 12th of June. However, because of the fact that we had to change

  • Getting error code 0x400110020000100b while doing system recovery for windows vista 32 bit.

    I attempted to do a system recovery on my Laptop using the included recovery discs and got this error 0x400110020000100B. THe disc looked pretty beat so last week I ordered a new set. Now when I got to put disc 2 in (at 80% complete) I get the same e

  • Return order in free Goods

    Dear Friends, Got a situation, where I created a sales order using Free goods (Inclusive) Concept. For every 10 goods you get 2 free ( 8+2). Delivery and billing is done. Customer returned the entire order. Then while creating return sales order with

  • Order by

    sir I am new to database and sql.i m doing sql course and preparing 4 1z0-051 by myself (and attaining a WDP course @ OAEC on 1z0-007).I need a help for this order by stuff: select employee_id , last_name,salary,department_id FROM employees --WHERE e

  • How do I decrease the size of a document?

    The file currently 5700 KB and I need it under 2500 KB.