Soft/Weak References: rule of thumbs?

After reading <a target="extern" href="http://java.sun.com/developer/technicalArticles/ALT/RefObj/index.html">Reference Objects and Garbage Collection</a> i browsed my code and replaced my listener containers with versions that store WeakReference objects. The main idea is to avoid memory leaks by storing references to objects that are not needed anymore (the listener container is the only strong reference left).
Another rule is to use SoftReferences for caches. But I haven't figured out a good way of implementing it (for caches that fill itself with one single SQL statement).
Are there any other examples where it's good advice to use Soft/Weak References?

For listeners, you have to make sure that the listener object is hard referenced - which is usually the case. After you release the listener object from the main application/object/thread, because it's finished or you don't need it anymore, the listener holder should not hold on to such references to avoid OutOfMemoryExceptions. Of course, the best way is always to unregister a listener, but unfortunately, we're not living in a perfect world. No listener is forced to unregister, they can simple forget to unregister. For this reason, it's better to tell the listener: if you register yourself, you should know that you are just referenced via WeakReferences. If the listener suddenly doesn't get listener events, this is a coding error which can be traced and fixed. But if a listener forgets to unregister itself, the resulting memory bloat is much harder to trace.
SQL table caches are difficult. On one hand you want to cache the data, on the other, you want to free this cache memory (temporarily) for more important memory usage. It's always a trade off between 2 advantages. If performance is not the big issue, but you get OutOfMemoryExceptions, then this is critical for the application to continue working. Better a little slower than not at all ... ;-)

Similar Messages

  • Please explain soft/weak references to me!

    What I would like to do is have following class:
    abstract class ImageContainer
      private Image img;
      public Image getImage()
        if (img==null)
          renderImage();
        return img;   
      public void lowMemory()
         img=null;
         System.gc();
      abstract protected void renderImage();
    }I think that you get my point, but this doesn't really work, since there's noplace where from call lowMemory() (and I mean low RAM memory, not low swapping memory, since this is to remove swapping during gameplay). I need somehow to use soft references or something like that so I was wondering if you could point me to right direction... I was unable to understand completily the API for package java.lang.ref

    abstract class ImageContainer
    private SoftReference imgRef = new SoftReference();
    public Image getImage()
       Image img = (Image)imgRef.get();
       if (img==null)
          img = renderImage();
          imgRef = new SoftReference(img);
       return img;
    abstract protected Image renderImage();
    }Reference objects "wrap" a regular hard reference, passed into the constructor. The "get" method returns that reference, or null if the object has been collected. (After a GC cycle for WeakReference, after a low-memory condition for SoftReference.) Therefore, upon fetch, call "get" on the reference class and check for null. If null, recreate and create a new reference class instance. Return the object either re-fetched or just created.

  • Are weak references cleared with soft ones?

    Suppose a program holds both weak and soft references to an object X. Suppose the virtual machine clears all the soft references at once, making X weakly reachable. Is the virtual machine guaranteed to clear all the weak references next before normal execution resumes?
    I ask because I am setting up an automatic interning system for immutable objects of a certain class that will guarantee that at most one object of a given value is reachable by the rest of the program at one time but will allow objects to be garbage collected if necessary. I need to decide what reference object(s) to keep to each interned object. If I keep only a weak reference, objects will be discarded at the whim of the virtual machine; I would prefer to keep them around longer so they don't have to be recreated so many times. If I keep only a soft reference, I am concerned that another part of the program might keep a weak reference. If the answer to my question above is "no", the soft reference could be cleared and the interning system could create a second object with the same value while the first is still accessible via the weak reference. It seems safest to keep both a soft reference and a weak reference and only recreate the object if the weak reference has been cleared.

    Softs hang around until memory needs dictate theygo.
    In my experience (Apple's 1.4 VM) this appears to be
    as soon as GC is run, making them effectively
    useless. Maybe VMs have improved.Not in my experience (Sun 1.4 VM). Soft references hang around forever. I had to stuff my class with bloat to make the instance larger, then change the VM heap size to get it to start collecting my soft references. Whereas the weak references are dumped ASAP. Inside scoop has it that finalizers will delay object collection a bit so be careful of that.
    Also the only guarantee is that soft is cleared before weak when they refer to the same object. in my experience weak references go quickly. Like at the first GC when they are weak. You can not depend on any timing with respect to when the weak will be cleared. I don't think the spec even guarantees that soft will be enqueued before weak. Im not sure on that point.

  • How strong ,soft ,weak ,phantom references are used in garbage collection

    Hi
    to all here.I have doubt that how garbage collection is deciding to cleaning up heap , and what are the roles of strong , soft , weak and phantom reference in garbage collection, i went throgh sun's java docs but i couldn't get any clear idea about those , please can anyone explain me with nice examples for which i will be really thankful.

    See:
    http://java.sun.com/developer/technicalArticles/ALT/RefObj/

  • IterateOverReachableObjects and soft/weak/phantom references

    Hi,
    what are soft/weak/phantom references for the JVM TI call IterateOverReachableObjects? Are those reference-objects
    1. ... "normal" objects having references and beeing traversed by this function
    (OR)
    2. ... interpreted as references with hiding the object nature
    (OR)
    3. ... ignored as they are ignored by the GC?
    Thanks,
    Robert

    The reference_kind with JVMTI_REFERENCE_FIELD, the referrer_tag will be the value of the tagged Reference instance, and the referrer_index will be the index of the "referent" field. It is this field that is treated in a special way by the GC.

  • Rules of thumb for sizing an Oracle BPM 11g deployment

    Anyone out there have some rules of thumb they are using to size out an environment for Oracle BPM 11g? I know processing power can vary widely for process complexity and amount of data floating around. Still, I get asked questions like how much processing power do I need for this solution? I have a current client looking at 2500+ potential human workflow users with 1000 concurrent at peak load. Short of running some performance test myself and extrapolating numbers I am at a loss. Hoping some others can chime in with some thoughts.

    an update... my rule of thumb for 50 users has proven to be a bit high. Looks to be 30-40 per core when you split out the BPMN engine from other computing intensive processes such as the ESB. Without splitting up overall SOA/BPM functionality over multiple servers concurrent user counts of various technology really takes a hit.

  • Eclipselink log levels issue with weak references

    Hi all,
    Is it possible to get null pointer exceptions if the log level in eclipselink is set to FINEST and you are logging a weak reference probably in a IdentityWeakReferenceMap and getting a null pointer exception because the weak ref has been garbage collected ?
    -Prashanth.

    I am getting Nullpointer exception when I set log level to FINER or FINEST in persistence.xml.
    DisRootEntityRef entity which is seen in below log has week reference in erml.
    Here is the exception full trace:
    EL Warning: 2010-05-31 17:06:52.328--UnitOfWork(19025200)--Thread(Thread[)--java.lang.NullPointerException
    at oracle.communications.platform.entity.impl.DisRootEntityRefDAO.getRootEntity(DisRootEntityRefDAO.java:300)
    at oracle.communications.platform.entity.impl.DisRootEntityRefDAO.getToString(DisRootEntityRefDAO.java:591)
    at oracle.communications.platform.entity.impl.DisRootEntityRefDAO.toString(DisRootEntityRefDAO.java:584)
    at java.text.MessageFormat.subformat(MessageFormat.java:1246)
    at java.text.MessageFormat.format(MessageFormat.java:836)
    at java.text.Format.format(Format.java:140)
    at java.text.MessageFormat.format(MessageFormat.java:812)
    at org.eclipse.persistence.internal.localization.EclipseLinkLocalization.buildMessage(EclipseLinkLocalization.java:77)
    at org.eclipse.persistence.internal.localization.TraceLocalization.buildMessage(TraceLocalization.java:30)
    at org.eclipse.persistence.logging.AbstractSessionLog.formatMessage(AbstractSessionLog.java:801)
    at org.eclipse.persistence.platform.server.ServerLog.log(ServerLog.java:71)
    at org.eclipse.persistence.internal.sessions.AbstractSession.log(AbstractSession.java:2571)
    at org.eclipse.persistence.internal.sessions.AbstractSession.log(AbstractSession.java:3664)
    at org.eclipse.persistence.internal.sessions.AbstractSession.log(AbstractSession.java:3636)
    at org.eclipse.persistence.internal.sessions.AbstractSession.log(AbstractSession.java:3612)
    at org.eclipse.persistence.internal.sessions.AbstractSession.log(AbstractSession.java:3534)
    at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.logDebugMessage(UnitOfWorkImpl.java:5397)
    at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerExistingObject(UnitOfWorkImpl.java:3874)
    at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerExistingObject(UnitOfWorkImpl.java:3844)
    at org.eclipse.persistence.queries.ObjectBuildingQuery.registerIndividualResult(ObjectBuildingQuery.java:362)
    at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java:588)
    at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:549)
    at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:489)
    at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:441)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:635)
    at org.eclipse.persistence.queries.ReadAllQuery.registerResultInUnitOfWork(ReadAllQuery.java:838)
    at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:464)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:997)
    at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:670)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:958)
    at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:432)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1021)
    at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2858)
    at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1225)
    at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1207)
    at org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:85)
    at org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:75)
    at org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:83)
    at org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiateImpl(UnitOfWorkValueHolder.java:161)
    at org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:230)
    at org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:83)
    at org.eclipse.persistence.indirection.IndirectList.buildDelegate(IndirectList.java:237)
    at org.eclipse.persistence.indirection.IndirectList.getDelegate(IndirectList.java:397)
    at org.eclipse.persistence.indirection.IndirectList$1.(IndirectList.java:525)
    at org.eclipse.persistence.indirection.IndirectList.listIterator(IndirectList.java:524)
    at org.eclipse.persistence.indirection.IndirectList.iterator(IndirectList.java:488)
    at oracle.communications.platform.persistence.impl.PomsArrayList.iterator(PomsArrayList.java:598)
    at oracle.communications.platform.entity.impl.DisResultGroupDAO.getRootEntities(DisResultGroupDAO.java:765)
    at oracle.communications.integrity.scanCartridges.sdk.RootEntityLoaderImpl.(RootEntityLoaderImpl.java:37)
    at oracle.communications.integrity.scanCartridges.sdk.BaseDiscrepancyDetectionController.init(BaseDiscrepancyDetectionController.java:71)
    at oracle.communications.integrity.scanCartridges.sdk.BaseDiscrepancyDetectionController.invoke(BaseDiscrepancyDetectionController.java:41)
    at oracle.communications.integrity.cartridges.ciscoextensioncartridge.detectionplugins.ciscodiscrepancydetectionsample.CiscoDiscrepancyDetectionSampleMessageDrivenBean.onMessage(CiscoDiscrepancyDetectionSampleMessageDrivenBean.java:109)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy343.onMessage(Unknown Source)
    at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:466)
    at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:371)
    at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:327)
    at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4585)
    at weblogic.jms.client.JMSSession.execute(JMSSession.java:4271)
    at weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3747)
    at weblogic.jms.client.JMSSession.access$000(JMSSession.java:114)
    at weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:5096)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    oracle.communications.integrity.cartridges.ciscoextensioncartridge.detectionplugins.ciscodiscrepancydetectionsample.CiscoDiscrepancyDetectionSampleMessageDrivenBean
    java.lang.NullPointerException
    at oracle.communications.platform.entity.impl.DisRootEntityRefDAO.getRootEntity(DisRootEntityRefDAO.java:300)
    at oracle.communications.platform.entity.impl.DisRootEntityRefDAO.getToString(DisRootEntityRefDAO.java:591)
    at oracle.communications.platform.entity.impl.DisRootEntityRefDAO.toString(DisRootEntityRefDAO.java:584)
    at java.text.MessageFormat.subformat(MessageFormat.java:1246)
    at java.text.MessageFormat.format(MessageFormat.java:836)
    at java.text.Format.format(Format.java:140)
    at java.text.MessageFormat.format(MessageFormat.java:812)
    at org.eclipse.persistence.internal.localization.EclipseLinkLocalization.buildMessage(EclipseLinkLocalization.java:77)
    at org.eclipse.persistence.internal.localization.TraceLocalization.buildMessage(TraceLocalization.java:30)
    at org.eclipse.persistence.logging.AbstractSessionLog.formatMessage(AbstractSessionLog.java:801)
    at org.eclipse.persistence.platform.server.ServerLog.log(ServerLog.java:71)
    at org.eclipse.persistence.internal.sessions.AbstractSession.log(AbstractSession.java:2571)
    at org.eclipse.persistence.internal.sessions.AbstractSession.log(AbstractSession.java:3664)
    at org.eclipse.persistence.internal.sessions.AbstractSession.log(AbstractSession.java:3636)
    at org.eclipse.persistence.internal.sessions.AbstractSession.log(AbstractSession.java:3612)
    at org.eclipse.persistence.internal.sessions.AbstractSession.log(AbstractSession.java:3534)
    at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.logDebugMessage(UnitOfWorkImpl.java:5397)
    at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerExistingObject(UnitOfWorkImpl.java:3874)
    at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerExistingObject(UnitOfWorkImpl.java:3844)
    at org.eclipse.persistence.queries.ObjectBuildingQuery.registerIndividualResult(ObjectBuildingQuery.java:362)
    at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java:588)
    at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:549)
    at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:489)
    at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:441)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:635)
    at org.eclipse.persistence.queries.ReadAllQuery.registerResultInUnitOfWork(ReadAllQuery.java:838)
    at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:464)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:997)
    at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:670)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:958)
    at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:432)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1021)
    at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2858)
    at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1225)
    at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1207)
    at org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:85)
    at org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:75)
    at org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:83)
    at org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiateImpl(UnitOfWorkValueHolder.java:161)
    at org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:230)
    at org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:83)
    at org.eclipse.persistence.indirection.IndirectList.buildDelegate(IndirectList.java:237)
    at org.eclipse.persistence.indirection.IndirectList.getDelegate(IndirectList.java:397)
    at org.eclipse.persistence.indirection.IndirectList$1.(IndirectList.java:525)
    at org.eclipse.persistence.indirection.IndirectList.listIterator(IndirectList.java:524)
    at org.eclipse.persistence.indirection.IndirectList.iterator(IndirectList.java:488)
    at oracle.communications.platform.persistence.impl.PomsArrayList.iterator(PomsArrayList.java:598)
    at oracle.communications.platform.entity.impl.DisResultGroupDAO.getRootEntities(DisResultGroupDAO.java:765)
    at oracle.communications.integrity.scanCartridges.sdk.RootEntityLoaderImpl.(RootEntityLoaderImpl.java:37)
    at oracle.communications.integrity.scanCartridges.sdk.BaseDiscrepancyDetectionController.init(BaseDiscrepancyDetectionController.java:71)
    at oracle.communications.integrity.scanCartridges.sdk.BaseDiscrepancyDetectionController.invoke(BaseDiscrepancyDetectionController.java:41)
    at oracle.communications.integrity.cartridges.ciscoextensioncartridge.detectionplugins.ciscodiscrepancydetectionsample.CiscoDiscrepancyDetectionSampleMessageDrivenBean.onMessage(CiscoDiscrepancyDetectionSampleMessageDrivenBean.java:109)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy343.onMessage(Unknown Source)
    at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:466)
    at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:371)
    at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:327)
    at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4585)
    at weblogic.jms.client.JMSSession.execute(JMSSession.java:4271)
    at weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3747)
    at weblogic.jms.client.JMSSession.access$000(JMSSession.java:114)
    at weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:5096)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

  • Cannot create weak reference to 'classobj' object

    I am trying to run the python Script in a C# program using Iron Python I am getting this type of Error
    cannot create weak reference to 'classobj' object
    I am using this code for running the python code
    var ironPythonRuntime = Python.CreateRuntime();
    try
    dynamic loadPython = ironPythonRuntime.UseFile("Program.py");
    catch (Exception ex)
    Console.WriteLine(ex.Message);

    Hi Mahesh,
    About IronPython issue, It's third-party product.  Please redirect to IronPython forum.  The link as below.
    https://ironpython.codeplex.com/workitem/list/basic
    After search this error,
    this thread tells me.
    Try to use virtualenv. It is used to separate many instances of python and it's libraries - you can have as many virtual environments as possible: python 2.5 , 2.6 , 2.7, whatever - with any combinations of libraries - so you can have for example five
    python 2.6 instances with different sets of libraries configured.
    By the way, here is also a blog talking about
    Running IronPython Scripts from a C# 4.0 Program
    Now I will move your thread to "off-topic" forum. Thanks for your understanding.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Rule of thumb for CACHE_SIZE

    Hi all,
    I do have a system outsourced, where the DB (MAXDB 7.6.05) runs on a single SLES 10 server.
    This server has got 16 GB RAM. The CACHE_SIZE is configured to 20 GB (2500000 pages) and a top shows me, that from the 40 GB swap 20 GB are used (file system cache is so low, that it can be ignored) ... and swapd runs with at least 6% CPU all the time.
    Is this a good situation? Not for me! Does anybody have a rule of thumb for CACHE_SIZE?
    I would say 75 % of RAM should be the highest value... any othe suggestion?
    Thank you!
    Christian

    Cache must always fit in the physical RAM. The purpose of the cache is to hold data in the memory that it doesn't need to be read again and again from the disk. If you now configure that cache bigger than the physical available RAM (minus application minus operating system) the system will start swapping/paging in and out and hence slowing down the full system.
    Ideally the machine is not swapping at all and all data is in the memory.
    Markus

  • Best book, website, or training for Illustrator 'rules of thumb'

    Hey everyone,
    To give some background I am terrible at art (no eye for it). Though I have recently been trying to learn Illustrator with a book and some online training videos (lynda). I am grasping some basics concepts on 'How to use the program' and what everything does.
    Though since I never took any graphic design course (I'm an engineer) I don't know what types of rules of thumb there are for making basic figures or pictures. What font is best? What type of arrows should I use? Width of stroke? Those are just basic examples of the type of questions I am always asking. So how do I take my basic knowledge of the actual program, and learn how to use those correctly?
    I'm an engineer making fairly basic diagrams or drawings for my research, but a slick drawing can really make you stand out. So that is where I'm coming from, I'm also a total begineer so please keep that in mind, I'm looking for more basic advice at the moment. For example below is one of the first drawings I have made in illustrator. Scientific work doesn't need to be too flashy, but any sources/locations would be great.
    Thank you so much in advance for helping a terrible artist!

    Hi there,
    There are a multitude of things you can do to foster your artistic intuition.
    1) Google. If you do a quick search for the "principles of design" you should come up with explanations and examples of just that. Here are a few links I came up with:
    - GD Basics gives you a brief rundown on design principles and elements as well as exercise prompts you can use to practice and apply what you've learned.
    - Learn the Basics is not nearly as elegant as the site above, but gives you real-world examples to show how art and design principles are applied.
    2) Take a class. I'm not sure if this is something that could possibly fit into your schedule, but you can take a basic art class at a community college or similar organization and it will help you tremendously. Being in a class will not only force you to practice and learn but you will have the support of your peers, which are generally at all skill levels.
    3) Find art and design you like, and take inspiration. I don't mean copy, but if you find an image where you appreciate the line weight, or the contrast of colors, or what have you, save it to an inspiration folder on your desktop. Figuring out what is effective and tasteful is something that takes time and lots of exposure to outside sources.
    Please let me know if I can help any further!
    Erica

  • Weak References in Listener Lists

    I've found a common source of memory leaks is when objects that add themselves to listener lists forget to remove themselves when they are done.
    It would be nice to generalize and say that listener lists should contain weak references, but there are probably valid cases where a listener's only valid reference is through the listener list.
    It would be nice to extend the listener pattern so that the listener could specify if they should be referenced weakly, for examplemodel.addChangeListener(this, true)where true indicates the reference to the listener should be weak.
    In some cases like the Model View Controller pattern, it probably makes sense that whenever a view listens to a model it should be weakly referenced. For example, when you construct a JTable and pass the model as a parameter to the constructor, the JTable should always specify a weak reference when it listens to the model.
    I think supporting a feature like this in the listener APIs could help reduce the potential for memory leaks and make code a little more maintainable.

    There was another time that I dabbled in this idea.
    But it always comes back to objects cleaning up
    after themselves. Now if its not your code and you
    cant ensure good behavior, then perhaps there is
    cause. But I'd keep an assert and report the issue
    if I saw it trigger.What would fire the assert? The Listener will never be garbage collected while it is listening to something. I assume that you are talking about when the listener is a Swing Object like a JFrame. I don't really like to use gui components as listeners.
    If you have to write a clean up method, it kind of defeats the value of having automatic garbage collection to a degree. I like to be able to let my Objects just fall out of scope or just become unreachable when they are no longer needed without having to actively manage their deallocation.

  • Determine indexes by rule of thumb - no data or table structures

    Hi,
    Im doing some research (would really like to see peoples answers)
    could some one give me an idea of the best way to index a tables the tables that appear in the statement below, to optimise performance.
    select p.fname, p.sname ,p.personid,av.availid, av.adate, nwa.hospitalid,
    nvl(to_char(av.astart,'HH24:MI'),'Not Specified') as ActualStart, nvl(to_char(av.aend,'HH24:MI'),'Not Specified') as ActualEnd, av.anyearly, av.anymiddle, av.anylate, av.anynight
    from tblperson p
    left outer join tblavailability av on p.personid = av.personid
    left outer join tblnurseworkarea nwa on p.personid = nwa.personid
    order by 1, 2;av.anyearly, av.anymiddle, av.anylate, av.anynight are all boolean fields 1/0
    Please, I need someone to tell me how they would index the tables used here, from instinct..... and rule of thumb....
    Much appriciated

    what about if the query were like so:
    select p.fname, p.sname ,p.personid,av.availid, av.adate, nwa.hospitalid,
    nvl(to_char(av.astart,'HH24:MI'),'Not Specified') as ActualStart, nvl(to_char(av.aend,'HH24:MI'),'Not Specified') as ActualEnd, av.anyearly, av.anymiddle, av.anylate, av.anynight
    from tblperson p
    left outer join tblavailability av on p.personid = av.personid
    left outer join tblnurseworkarea nwa on p.personid = nwa.personid
    WHERE av.availid = 3
    order by 1, 2;any difference in what you would do?

  • Rule of Thumb in using Infinitely Thin conductor in EM simulation?

    Does anyone know when is it safe to use approximately thin conductor during EM simulation in Axiem?
    How about the ratio of the dielectric thickness to the copper thickness?
    Solved!
    Go to Solution.

    For conductor loss, both thin and thick metal will work pretty much the same.  The most obvious place where thickness matters is with coupling between metal on the same layer.  The penalty you pay for metal thickness is that AXIEM must solve for more unknowns, somewhere between 2 and 3x the amount.  
    At some point the coupling due to the metal thickness has a big effect on the coupling.   It is hard to say an exact rule of thumb when to make the switch as it will matter how far away your ground plane is on the bottom and how thick the metal is.    What I suggest you do is setup a microstrip coupled line simulation using the technology you are using and then sweep the distance between the lines for both a thick and thin metal case and see when the two answers converge.  
    A couple other points.  
    1.  Check the option for using edge meshing when using thick metal.  For the most accurate answer and a good comparison, you will want to make sure you are edge meshing the thick metal.   
    2.  I have not seen the ratio of dielectric thickness to copper thickness matter much, but you could run a similar experiment, just seeing if it matters.   The biggest issue here is making sure you get the distance between your ground plane and the trace right.  If you are using the boundary of the structure for the ground, this usually isn't a problem.  But if you have ground planes at other locations in your stackup, you will need to adjust dielectric thicknesses depending on if you are using thin or thick metal to make sure the thickness of the dielectric is correct.   

  • JMX and weak references

    Hi,
    We are having a problem where an RMI object is not being garbage collected. A fellow developer has suggested that since the JMX server has a reference to the object it will never be garbage collected. Does anyone know if the JMX server keeps a weak reference to an object or to garbage collect the object you must unload it from the JMX server?

    Hi,
    We are having a problem where an RMI object is not
    ot being garbage collected. A fellow developer has
    suggested that since the JMX server has a reference
    to the object it will never be garbage collected.
    Does anyone know if the JMX server keeps a weak
    reference to an object or to garbage collect the
    object you must unload it from the JMX server?not sure exactly what you are saying; but jmx deals with mbeans only. if your remote object is not an mbean object, it would have nothing to do with jmx. to kill an mbean object, use jms to unload it.

  • Module conflict rules of thumb?

    I was wondering how to go about detecting module conflicts. It seems that most of my encounters with such events were solved through finding stand-alone answers to the particular module in question.
    Each time I, being somewhat of a linux kernel newbie, had no idea how the people answering the questions found out that module X was conflicting with module Y.
    Any set rules of thumb to go about detecting these conflicts?
    FYI: the past experiences were with the rt2870 wireless driver and the Poulsbo psb graphics driver.

    an update... my rule of thumb for 50 users has proven to be a bit high. Looks to be 30-40 per core when you split out the BPMN engine from other computing intensive processes such as the ESB. Without splitting up overall SOA/BPM functionality over multiple servers concurrent user counts of various technology really takes a hit.

Maybe you are looking for