Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

git-svn-id: https://j-interop.svn.sourceforge.net/svnroot/j-interop/t…

…runk@136 500440a9-ff40-0410-9efe-e02887d06806
  • Loading branch information...
commit 1ea4138dceb488d9c025a98996ab893987f2b744 1 parent 2ae5ae3
authored May 26, 2011
24  j-interop/src/org/jinterop/dcom/core/JISession.java
@@ -245,10 +245,8 @@ private static String getLocalHost(String destination)
245 245
 		JIComOxidRuntime.startResolver();
246 246
 		JIComOxidRuntime.startResolverTimer();
247 247
 		oxidResolverPort = JIComOxidRuntime.getOxidResolverPort();
248  
-        // This schedule used to be every 3 mins. It was drastically reduced 
249  
-        // to 10 seconds because otherwise it would try and release too 
250  
-        // many IPIDS at once.
251  
-		releaseRefsTimer.scheduleAtFixedRate(new Release_References_TimerTask(),0,10*1*1000);
  248
+        // This schedule used to be every 2 mins. 
  249
+		releaseRefsTimer.scheduleAtFixedRate(new Release_References_TimerTask(),0,2*60*1000);
252 250
 
253 251
 		Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
254 252
 			public void run() {
@@ -275,6 +273,18 @@ public void run() {
275 273
 
276 274
 	}
277 275
 
  276
+	/** Cancels the existing timer used to schedule collection of un-referenced COM Objects and then restarts the same with the new frequency. Default timer schedules the GC task 
  277
+	 * every 2 mins.  
  278
+	 * 
  279
+	 * @param timeInMilliSec
  280
+	 */
  281
+	public static void setReleaseRefTimerFrequency(int timeInMilliSec)
  282
+	{
  283
+		releaseRefsTimer.cancel();
  284
+		releaseRefsTimer = new Timer(true);
  285
+		releaseRefsTimer.scheduleAtFixedRate(new Release_References_TimerTask(), 0, timeInMilliSec);
  286
+	}
  287
+	
278 288
 	private static class Release_References_TimerTask extends TimerTask
279 289
 	{
280 290
 		public void run() {
@@ -766,7 +776,7 @@ void addToSession(IJIComObject comObject, byte[] oid)
766 776
 //		debug_addIpids(comObject.getIpid(),((JIStdObjRef)comObject.internal_getInterfacePointer().getObjectReference(JIInterfacePointer.OBJREF_STANDARD)).getPublicRefs());
767 777
 	}
768 778
 
769  
-    public void addRef_ReleaseRef(String IPID, JICallBuilder obj, int refcount) throws JIException
  779
+    void addRef_ReleaseRef(String IPID, JICallBuilder obj, int refcount) throws JIException
770 780
     {
771 781
         updateReferenceForIPID(IPID, refcount);
772 782
         getStub2().addRef_ReleaseRef(obj);
@@ -796,7 +806,7 @@ private void updateReferenceForIPID(String ipid, int refcount)
796 806
             mapOfIPIDsVsRefcounts.remove(ipid);
797 807
 	}
798 808
     
799  
-    public void addWeakReference(IJIComObject comObject, byte[] oid)
  809
+    void addWeakReference(IJIComObject comObject, byte[] oid)
800 810
     {
801 811
         IPID_SessionID_Holder holder = new IPID_SessionID_Holder(comObject.getIpid(), getSessionIdentifier(), false, oid);
802 812
 		synchronized (mapOfObjects)
@@ -818,7 +828,7 @@ public void addWeakReference(IJIComObject comObject, byte[] oid)
818 828
 
819 829
     
820 830
     /* Reduce the count of weak-references stored in mapOfIPIDsVsWeakReferences and return the same. */
821  
-    public int removeWeakReference(String ipid)
  831
+    int removeWeakReference(String ipid)
822 832
     {
823 833
         if (JISystem.getLogger().isLoggable(Level.FINEST))
824 834
         {

0 notes on commit 1ea4138

Please sign in to comment.
Something went wrong with that request. Please try again.