Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
vikramrc authored
Showing with 17 additions and 7 deletions.
  1. +17 −7 j-interop/src/org/jinterop/dcom/core/JISession.java
View
24 j-interop/src/org/jinterop/dcom/core/JISession.java
@@ -245,10 +245,8 @@ private static String getLocalHost(String destination)
JIComOxidRuntime.startResolver();
JIComOxidRuntime.startResolverTimer();
oxidResolverPort = JIComOxidRuntime.getOxidResolverPort();
- // This schedule used to be every 3 mins. It was drastically reduced
- // to 10 seconds because otherwise it would try and release too
- // many IPIDS at once.
- releaseRefsTimer.scheduleAtFixedRate(new Release_References_TimerTask(),0,10*1*1000);
+ // This schedule used to be every 2 mins.
+ releaseRefsTimer.scheduleAtFixedRate(new Release_References_TimerTask(),0,2*60*1000);
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
public void run() {
@@ -275,6 +273,18 @@ public void run() {
}
+ /** 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
+ * every 2 mins.
+ *
+ * @param timeInMilliSec
+ */
+ public static void setReleaseRefTimerFrequency(int timeInMilliSec)
+ {
+ releaseRefsTimer.cancel();
+ releaseRefsTimer = new Timer(true);
+ releaseRefsTimer.scheduleAtFixedRate(new Release_References_TimerTask(), 0, timeInMilliSec);
+ }
+
private static class Release_References_TimerTask extends TimerTask
{
public void run() {
@@ -766,7 +776,7 @@ void addToSession(IJIComObject comObject, byte[] oid)
// debug_addIpids(comObject.getIpid(),((JIStdObjRef)comObject.internal_getInterfacePointer().getObjectReference(JIInterfacePointer.OBJREF_STANDARD)).getPublicRefs());
}
- public void addRef_ReleaseRef(String IPID, JICallBuilder obj, int refcount) throws JIException
+ void addRef_ReleaseRef(String IPID, JICallBuilder obj, int refcount) throws JIException
{
updateReferenceForIPID(IPID, refcount);
getStub2().addRef_ReleaseRef(obj);
@@ -796,7 +806,7 @@ private void updateReferenceForIPID(String ipid, int refcount)
mapOfIPIDsVsRefcounts.remove(ipid);
}
- public void addWeakReference(IJIComObject comObject, byte[] oid)
+ void addWeakReference(IJIComObject comObject, byte[] oid)
{
IPID_SessionID_Holder holder = new IPID_SessionID_Holder(comObject.getIpid(), getSessionIdentifier(), false, oid);
synchronized (mapOfObjects)
@@ -818,7 +828,7 @@ public void addWeakReference(IJIComObject comObject, byte[] oid)
/* Reduce the count of weak-references stored in mapOfIPIDsVsWeakReferences and return the same. */
- public int removeWeakReference(String ipid)
+ int removeWeakReference(String ipid)
{
if (JISystem.getLogger().isLoggable(Level.FINEST))
{
Please sign in to comment.
Something went wrong with that request. Please try again.