Correct way to close session

Hi,
I'm working with flash, not flex. I want to be able to
1. add an afcs object to stage,
2. subscribe to a baton property,
3. unsubscribe
4. remove the afcs object
5... repeat
1 to 4 are working, but when I try and repeat the process, I can't seem to subscribe.
I have three buttons on stage to add, logout and remove
function onLogin(e:MouseEvent):void
cocomo = new CocomoTest();
addChild(cocomo);
cocomo.login();
function onLogout(e:MouseEvent):void
cocomo.destroy();
function onRemove(e:MouseEvent):void
removeChild(cocomo);
And this is the Class
package
import flash.display.*;
import flash.events.*;
import com.adobe.rtc.session.ConnectSession;
import com.adobe.rtc.authentication.AdobeHSAuthenticator;
import com.adobe.rtc.authentication.LocalAuthenticator;
import com.adobe.rtc.events.SessionEvent;
import com.adobe.rtc.sharedModel.SharedProperty;
import com.adobe.rtc.sharedModel.BatonProperty;
import com.adobe.rtc.events.SharedPropertyEvent;
import com.adobe.rtc.events.SharedModelEvent;
public class CocomoTest extends MovieClip
  private var auth:AdobeHSAuthenticator;
  private var authL:LocalAuthenticator;
  private var session:ConnectSession;
  public var table1_northPlayer:BatonProperty;
  private var LOGINSYNCTYPE:String;
  public function Cocomo()
  //so step[ 1 is to log in...
  //after login and subscribing, I get notified:
  //RECEIVENODES table1_northPlayer
  //receiveAllSynchData table1_northPlayer
  public function login():void
   auth      = new AdobeHSAuthenticator();
   auth.userName     = "myname";
   session     = new ConnectSession();
   session.roomURL   = "myroomurl";
   session.authenticator  = auth;
   session.addEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, onLogin);
   try
    LOGINSYNCTYPE    = "login";
    session.login();  
   catch(e:Error)
    trace (e.toString());
  //then i logout, close, any number of combinations i've tried
  //and remove the object from stage
  public function destroy():void
   table1_northPlayer.close();
   LOGINSYNCTYPE    = "logout";
   session.logout();
  private function onLogin(p_evt:SessionEvent):void
   switch (LOGINSYNCTYPE)
    case "login":
     trace ('login');
     table1_northPlayer     = new BatonProperty();
     table1_northPlayer.sharedID      = "table1_northPlayer";
     table1_northPlayer.subscribe();
    break;
    case "logout":
     trace ('logout');
     LOGINSYNCTYPE    = "close";
     session.close();
    break;
finally, when I try and repeat the process, i log in ok, but don't get the
RECEIVENODES table1_northPlayer
receiveAllSynchData table1_northPlayer
It seems like I'm not claring something properly but I'm not sure what.
Any help appreciated.

Hi Mr. Turtle,
In this case, you're unwittingly taking advantage of the fact that LCCS objects, by default, subscribe themselves to the first ConnectSession you create. However, because you're creating fresh ConnectSessions each time, the objects are still grabbing an old ConnectSession, so they never succeed in synching past the first time. 2 ways you can remedy this :
1.  Explicitly bind your LCCS objects to the correct ConnectSession. (ie. table1_northPlayer.connectSession = session;)
2.  Instead of creating new ConnectSessions each time, re-use the original one.
Either approach should work.
  hope that helps,
   nigel

Similar Messages

  • Correct way to aqquire session on a J2EE environment

    Hi.
    I'm working on a software that uses session beans (configured with JTA) accessing TopLink through a Data Acess Object. The DAO is a sigleton (used by all session bean instances) that has private getActiveSession() method that returns the session to be used by each DAO method.
    The method is codded like bellow:
    private Server server = null; //class attribute
    ... getActiveSession(){       
    if (server == null){
    server = (Server) SessionManager.getManager().getSession(new XMLSessionConfigLoader(), mapeamento, this.getClass().getClassLoader(), true, false, true);
    return server.getActiveSession();
    Is it the correct way to work with the architecture I'm using? (holding a server Session and working with it)
    I'm having problems when a database exception is thrown and when a database connection become stale. I don't know how to solve it because some times the application recovers themselves and some times not (intermitent).
    Thanks,
    Eros

    Hello Doug. Thanks for your post.
    I'm using the Container Datasource. How I can handle the connection failures?
    Another question: This code is causing the following error in a multithread environment:
    Exception [TOPLINK-7001] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 050912)): oracle.toplink.exceptions.ValidationException
    Exception Description: You must login to the ServerSession before acquiring ClientSessions.
    Environment:
    - The toplink jar is within the APPLib OC4J instance classpath
    - The DAO is within EAR
    - The OC4J instance has 6 applications (EARs)
    - The EJB with the business rules calls the DAO singleton object to access the Database
    The error happens some times and some times not. Please Help.
    Eros

  • What is the correct way to close processor? I searched board, no good...

    I have the current setting for video:
    2 processors - one audio, one video
    2 datasources - audio,video
    2 send streams - audio,video
    4 rtpmanagers - 2 rec. 2 send.
    When I close only the video send - sendstream, rtpmanager and processor the audio hangs and comes to a crawl like 1 second per minute. I commented out the processor closing function with sendstream and rtpmanager closed and disposed the audio doesn't hang. So I am pretty sure the processor closing method is causing me problems... I searched through the forum but still cant get it to work... I have :
    processor.stop();
    processor.close();
    and I also used processor.deallocate() instead and after processor.close() - no luck.
    I am pretty convinced it is the processor since the program works fine with the close method commented out and if i put it back in it hangs... any ideas? thanks!

    A colleague of mine was kind enough to solve this:
    The calendar has ActivityStyles property = #{calendarBean.activityStyles}
    CalendarBean looks something like this:
    package com.hub.appointmentscheduler.ui.schedule;
    import java.util.HashMap;
    import java.util.HashSet;
    import java.util.Set;
    import oracle.adf.view.rich.util.CalendarActivityRamp;
    import oracle.adf.view.rich.util.InstanceStyles;
    +public class CalendarBean {+
    private HashMap activityStyles;
    private String dummy;
    +public CalendarBean() {+
    +// Define colors+
    activityStyles = new HashMap<Set<String>, InstanceStyles>();
    HashSet setPending = new HashSet<String>();
    HashSet setArrived = new HashSet<String>();
    HashSet setApproved = new HashSet<String>();
    HashSet setCompleted = new HashSet<String>();
    setApproved.add("APPROVED");
    setPending.add("PENDING");
    setArrived.add("ARRIVED");
    setCompleted.add("COMPLETED");
    activityStyles.put(setApproved, CalendarActivityRamp.getActivityRamp(CalendarActivityRamp.RampKey.GREEN));
    activityStyles.put(setPending, CalendarActivityRamp.getActivityRamp(CalendarActivityRamp.RampKey.ORANGE));
    activityStyles.put(setArrived, CalendarActivityRamp.getActivityRamp(CalendarActivityRamp.RampKey.PLUM));
    activityStyles.put(setCompleted, CalendarActivityRamp.getActivityRamp(CalendarActivityRamp.RampKey.LAVENDAR));
    +}+
    +public void setactivityStyles(HashMap activityStyles) {+
    this.activityStyles = activityStyles;
    +}+
    +public HashMap getactivityStyles() {+
    return activityStyles;
    +}+
    +}+
    Now, go into the Bindings tab on the calendar page, double click the calendar binding, and specify the column you've defined as the calendar's Provider in the Tags dropdown.
    Should show colors.

  • Right way to close a dialog?

    I'm working on an Application in which users update data in non-modal dialogs. We have been coding these dialogs as subclasses of JFrame. I know this sounds like a very-basic question, but I've searched stacks of books and numerous messages in this forum.
    What's the correct way to close a dialog box. I need to achieve the following:
    1. Free memory of the object that implemented the dialog box as well as any memory resources the system used to realize it on the screen. In other words, no memory leaks. (I assume setting defaultCloseOperation to WindowConstants.DISPOSE_ON_CLOSE would help with the memory cleanup).
    2. I don't want to close down the entire application when someone clicks on the OK button. This, of course, rules out the technique used in all the single-screen Swing tutorials, which is to call System.exit(0).
    Thank you so much!

    hey tim. I had the same problem recently. try putting dispose(); in the action listener for your OK button. this should work!
    greg

  • What is the proper way to close all open sessions of a NI PXI-4110 for a given Device alias?

    I've found that, when programming the NI PXI-4110 that, if a the VI "niDCPower Initialize With Channels VI" (NI-DCPower pallette) is called with a device
    alias that all ready has one or more sessions open (due to an abort or other programming error) a device reference results from the reference out that has a (*) where "*" is post-fixed to the device reference where and is an integer starting that increments with each initialize call. In my clean up, I would like to close all open sessions. For example, let's said the device alias is "NIPower_1" in NI Max, and there are 5 open sessions; NIPower_1, NIPower_1 (1), NIPower_1 (2), NIPower_1 (3), and NIPower_1 (4). A simple initialize or reset (using niDCPower Initialize With Channels VI, or, niDCPower Initialize With Channels VI, etc.) What is the proper way to close all open sessions?
    Thanks in advance. Been struggleing with this for days!

    When you Initialize a session to a device that already has a session open, NI-DCPower closes the previous session and returns a new one. You can verify this very easily: try to use the first session after the second session was opened.
    Unfortunately, there is a small leak and that is what you encountered: the previous session remains registered with LabVIEW, since we unregister inside the Close VI and this was never called. So the name of the session still shows in the control like you noted: NIPower_1, NIPower_1 (1), NIPower_1 (2), NIPower_1 (3), and NIPower_1 (4), etc.
    There may be a way to iterate over the registered sessions, but I couldn't find it. However, you can unregister them by calling "IVI Delete Session". Look for it inside "niDCPower Close.vi". If you don't have the list of open sessions, but you have the device name, then you can just append (1), (2) and so forth and call "IVI Delete Session" in a loop. There's no problem calling it on sessions that were never added.
    However - I consider all this a hack. What you should do is write code that does not leak sessions. Anything you open, you should close. If you find yourself in a situation where there are a lot of leaked sessions during development, relaunching LabVIEW will clear it out. If relaunching LabVIEW is too much of an annoyance, then write a VI that does what I described above and run it when needed. You can even make it "smarter" by getting the names of all the NI-DCPower devices in your system using the System Configuration or niModInst APIs.
    Hope this helps.
    Marcos Kirsch
    Principal Software Engineer
    Core Modular Instruments Software
    National Instruments

  • HT5622 my new samsung phone will not receive text messages from my old iphone friends and family.  I was told that I need to close my icloud account in order to correct this issue but I cannot find a way to close my icloud.  Help?

    I cannot receive text messages on my new samsung phone from any of my old iphone contacts.  I was told that I need to close my icloud in order to fix this problem but i can't find a way to close my icloud account.  Help...

    You can try changing the password for the Apple ID you were using for iMessage on your iPhone by going to https://iforgot.apple.com.  If that doesn't help, you'll have to contact Apple support for assistance: http://www.apple.com/support/contact/.

  • Best way to close a Runtime.exec() process and how to handle closing it?

    I have multiple Runtime.exec() Processes running and am wondering what the best way it is to close them and take care of closing the resources. I see that Process.destroy() seems to be the way to terminate the Process - is finalize() the best way to close anything in that Process?
    Thanks

    I was involved with your other thread, so I think I know what you are trying to do.
    All Dr's answers are correct.
    Now you have a program A written by you that does Runtime.exec() of multiple instances
    of another program B written by you. You want A to somehow tell B to exit.
    You must use some kind of Inter Process Communication. If this is the only interraction
    between the two programs I can suggest two options. If you anticipate more
    interraction, you may want to look at other means (RMI, for instance, which was proposed
    by EJP in the other thread for starting B, is also useful in exchanging info).
    Solution 1:
    Start a thread in B and read stdin. A will write to stdin a command, such as QUIT.
    When B reads it, it does System.exit().
    Solution 2:
    Start a SocketServer in B that accepts connections on a separate thread.
    When A wants B to exit, it connects to it and writes a command such as QUIT.
    When B reads it, it does System.exit().
    You may note that QUIT is not the only command you can send from A to B, in case you will need more.
    Edited by: baftos on Nov 5, 2007 2:15 PM

  • Correct way to obtain AppModule from ManagedBean?

    hi,
    There are many posts on this forum and others in the net with examples on how to obtain an AppModule from a ManagedBean (some of them uses depecrated methods, like using ValueBinding). But what's the correct way to do so?
    Is this the correct one ?
    HttpServletRequest request =
         (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
    HttpSession session = request.getSession(true);
    BindingContext ctx = (BindingContext)session.getAttribute("data");
    DataControl control = ctx.findDataControl("InstelAMDataControl");
    ApplicationModule appModule = (ApplicationModule)control.getDataProvider();
    Thanks!
    Roger

    Roger,
    this is one possible way to get the ApplicationModule inside a bean.
    you can do this via an EL too
                FacesContext facesContext = FacesContext.getCurrentInstance();
                Application app = facesContext.getApplication();
                ExpressionFactory elFactory = app.getExpressionFactory();
                ELContext elContext = facesContext.getELContext();
                ValueExpression valueExp =  elFactory.createValueExpression(elContext, expression, Object.class);
                ApplicationModule am = (ApplicationModule)  valueExp.getValue("#{data." + YourApplicationModuleName + ".dataProvider}");This is essential the same, but uses an EL to get the data provider.
    It's more a philosophical question if there is aright way to do it.
    Timo

  • Correct Way to Look at ROWID value

    I found some sql and modified it that is suppose to allow you to look at the ROWID info of a table
    Can someone tell me why this does not work and what would be the correct way to get the info based on the ROWID ?
    Evertyime I generate the ROWIDs and try to enter one into the second SQL statement, I get nothing back
    Example:
    prompt
    prompt ******************
    prompt V$Session/DBA_Objects - Create RowIDs
    prompt ******************
    prompt
    select
         s.sid,
         s.terminal,
         do.object_name,
         row_wait_obj#,
         row_wait_file#,
         row_wait_block#,
         row_wait_row#,
         dbms_rowid.rowid_create ( 1, ROW_WAIT_OBJ#, ROW_WAIT_FILE#, ROW_WAIT_BLOCK#, ROW_WAIT_ROW# ) rowid_created
    from
         v$session s,
         dba_objects do
    where
         s.ROW_WAIT_OBJ# = do.OBJECT_ID
    order by
         s.sid;
    prompt
    prompt ******************
    prompt Get ROWID Info
    prompt ******************
    prompt
    select * from &table_select where rowid = '&rowid_created';
    Any assistance would be appreciated
    Thanks
    Jim

    Hi Miguel
    well i am using thread based processes into oracle and some of my users are getting CGI timeouts or else getting tired of waiting and trying to do the same task again through my web app so they try it again causing a lock problem
    I can see what is being locked down to the table but i wanted to know what data is being locked when trying to get updated, so i thought i could use the ROWID to look at the entry
    Thanks
    Jim

  • Correct way to set up mutiple 4410Ns

    hello, we have 7 4410N's.  i am not sure i have them configured correctly, as connection is very slow, most of the time the connection gets an IP address, but then cannot transmit on network.  when you can, pings are 2000-3000ms.   each of them have ethernet connection, and identical configuration, save for each is set to a different channel (i think im using 1,3,5,6,7,9,11).  i am concerned there is some other issue i am not aware of with my configuration. 
    i would like to find out the correct way to configure multiple 4401Ns to work together on the same network, assuming same SSIDs are in use on each WAP.  can anyone offer me advice on what is correct?

    Jonathan,
    I assume that when you say "identical configuration" that you mean they have different IP addresses.
    How close are the APs to each other? With 7 of them using the channels that you have, if they are within range of each other they will have crosstalk.
    If you disable 6 of the APs, do you still get the high response times from the remaining one?
    - Marty

  • Sapinst - what is the correct way to startup sapinst

    I am starting install of NW04 on unix. The install manual states that once env paramters are set then do the following:
    cd /SAP_MASTER_DVD/IM2/SAPINST/UNIX/SUN...
    then run ./sapinst
    however run I run it it just waits.....
    I then go back in another session and run startInstGui.sh
    and the sapinst install screen successfully appears?
    Is this the correct way to run the install?
    What is the correct way to run sapinst?
    Thank
    John Ryan

    Figured it out...
    sudo su root not - root
    and it works

  • Elements 13 crashes - Windows message - this program is not working correctly - windows will close it.

    I bought Elements 13 4 days ago through Amazon - so far it has not run for more than 5 minutes before Windows closes it down with the message - this program is not working correctly, windows will close it. I know this is not unusual but has anyone got a solution - apart from returning  it
    with a very unfavourable review? I have tried all the suggested fixes on the Adobe help site with no result.  Elements 10 runs OK on the same machine.
    Alternatively, is there any possible way to get support from Adobe?

    juliana
    Do you have any version of Premiere Elements 13 or only Photoshop Elements 13 which comes with Elements Organizer 13?
    Let us look at the following for Elements Organizer 13....
    1. Deletion of disabling the Elements Organizer 13 setting file which is named psa.prf. In Windows 7, 8, o 8.1 64 bit, it is found in the
    path
    Local Disk C
    Users
    Owner
    AppData
    Roaming
    Adobe
    Elements Organizer
    13.0
    Organizer
    and in the Organizer Folder is the psa.prf file that you delete or disable by renaming it from psa.prf to psa.prfOLD.
    2. If the above gains you successful entry into the Elements Organizer 13, then you can
    a. create a new catalog
    and/or
    b. repair or optimize the current one
    See Elements Organizer 13/File Menu/Manage Catalogs/Catalog Manager.
    3. There are times that certain formats will bring the Elements Organizer down when you try to import those formats into
    it.  But, from what you wrote, your current problems do not sound media related.
    3. At your earliest opportunity, please update Elements Organizer 13 to 13.1 using its Help Menu/Updates.
    Please review and consider and then let us know the outcome.
    Thank you.
    ATR

  • Sapinst for NW04 - correct way to run sapinst

    I am starting install of NW04 on unix. The install manual states that once env paramters are set then do the following:
    cd /SAP_MASTER_DVD/IM2/SAPINST/UNIX/SUN...
    then run ./sapinst
    however when I run ./sapinst it just waits.....
    I then go back in another session and run startInstGui.sh
    and the sapinst install screen successfully appears?
    Is this the correct way to run the install?
    What is the correct way to run sapinst?
    Thank
    John Ryan

    Figured it out...
    sudo su root not - root
    and it works

  • I have a spelling app that is stuck on the screen - it doesn't have any way to close it out, and when I split the screen and go to "Finder" to remove it, it says that it can't, because the program is still open. Please help.

    I have a spelling app that is stuck on the screen - it doesn't have any way to close it out, and when I split the screen and go to "Finder" to remove it, it says that it can't, because the program is still open. Please help.

    Paul,
    I'm sure this is the correct answer, but just switched to Apple, so am just an apple seed at this point! :~)
    How do I get to the Apple Menu?
    Thanks!
    KL

  • TS1424 HELLO! whenever i try to access the itunes store from the itunes on my laptop i get this message: ITUNES HAS STOPPED WORKING a problem caused the program to stop working correctly. windows will close the program and notify if a solution is availabl

    for a few weeks i have not been able to access the itunes store from the itunes on my laptop. every time i click on it it tells me it cannot access the store...not sure why. and says this: ITUNES HAS STOPPED WORKING a problem caused the program to stop working correctly. windows will close the program and notify if a solution is available.

    I had this exact same problem.  I found this fix and it worked for me. 
    Step 1:
    Browse to C:\Program Files (x86)\Common Files\Apple\Apple Application Support and copy the filen named QTMovieWin.dll. 
    Step 2:
    Browse and past that file into C:\Program Files (x86)\iTunes.
    Hope this helps you.  I wish I could remember where I saw this originally so I could thank them.
    Good Luck.
    Anthony

Maybe you are looking for

  • ICal auf iPhone synchronisieren: in iCal gelöschte Ereignisse bleiben im iPhone

    Hallo Apple-Community In meinem iCal-Kalender im iPhone herrscht das Chaos. Ereignisse, die ich ein- oder mehrmals in iCal meines MacBookPro verschoben habe, bleiben beim Syncen mit iTunes auf dem iPhone bestehen. So sind manche Einträge mehrfach vor

  • Error while running wsimport.

    Hi, I am trying to generate the Java artifacts frm a wsdl file. I am using jaxws-ri_2.1.3 . When I run wsimport the process dies with the following message "Schema descriptor {http://www.w3.org/2001/XMLSchema}XmlDataDocument in message part "return"

  • USB Memory Stick won't work on my Dual Core Intel Mac...

    Just bought a 4gb memory stick a few days ago - it doesn't seem to like my Dual Core Intel Tower at all. I am plugging it into the USB slot at the front and trying to copy a load of files onto it. It's got around 1gb on it now and I can't seem to cop

  • Output Device Selections Not Available?

    Finally have upgraded to a DLT 7000 and now - in DVD Studio Pro 3.0.2 under the General Tab - I am not getting any destination options for outputting. Any clues? I am using a Atto SCSI card and with Atto have already determined the drive IS being rec

  • PC Distiller 9.0 vs Mac Distiller 9.0

    We are working on Mac environment. The watched folder (path map to network  driver) in Mac Distiller has been deleted automatically when we quit the distiller and open it again on Mac. In  the other way, unfortunately the network disconnects, the wat