• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Session count
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Session count


  • Subject: Re: Session count
  • From: Thomas LATTER <email@hidden>
  • Date: Mon, 12 Sep 2016 19:12:08 +0200

Hi Calvin,

My app was already fetching the application().activeSessionsCount() from the server every 30 seconds.
So now in the same DirectAction I also update a new small table in my database with a row for each of my instances and two columns(Instance ID, active count). I can now fetch this data and display the active counts of the other instances of my app. I had to add a little extra so that when an instance's last session terminated the count in the database would go down to zero, to do this I overrid the terminate() function in Session.java to something like this:

public void terminate(){
// If this is the last session on the instance we update the DB session count to 0 before terminating it
if(this.application().activeSessionsCount() == 1){
EOEditingContext editingContext = this.defaultEditingContext();
String instanceId = String.valueOf(this.context().request().applicationNumber()); 
WebInstance instance = WebInstance.fetchRequiredWebInstance(editingContext, ERXQ.equals(WebInstance.ID_KEY, Integer.valueOf(instanceId)));
instance.setActiveCount(0);
editingContext.saveChanges();
}
}
super.terminate();
}

2016-09-12 18:33 GMT+02:00 Calven Eggert <email@hidden>:
Thomas,

I'm interested in knowing the solution you used. thanks.

Calven
-----------
Message: 3
Date: Mon, 12 Sep 2016 18:01:53 +0200
From: Thomas LATTER <email@hidden>
To: Marco A Gonzalez <email@hidden>,
email@hidden
Subject: Re: get active session count for all instances
Message-ID:
<CABavYTD86kZn8DT1eb6wj8Ln41h7F=t40DkyT5z7q24GzgM7MQ@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Thanks Marco,

I found a solution to this. Yes I have got all this in my JavaMonitor, but
I needed to retrieve the info in java to display on screen from within one
of the instances. So now I just continuously update a small table in a
database with the active counts of each instance.

Thomas


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Where did this error come from???
  • Next by Date: Re: Where did this error come from???
  • Previous by thread: Re: Where did this error come from???
  • Next by thread: AIX deployment
  • Index(es):
    • Date
    • Thread