New Object() with no reference

I'm creating an object and don't want it to waste space after being created. It's a thread spawner and just want it to create the threads and wait auntil they finish.
my idea was to write
new Object();but don't know if it's a nice idea. This way there will be no reference. Maybe it's better:
Object object = new Objeect();
object = null;I'd rather use the first one. Any opinion? Thanks!

malcolmmc wrote:Under no circumstances will the garbage collector recycle an active thread or the stackframes associated with it. That would crash the thread. So it doesn't matter if you retain a reference to it or not, except that if you want to wait for all the threads to finish then the respectable approach is to call join on all of them, for which you obviously need your own reference to the thread.Think about the spawner as a subprogram that creates threads, not as a thread itself. It would be INSIDE the spawner where threads would be created and joins would be executed. Once we would get out of the spawner, threads would be finished, so there would be no reference to them at all.
I realized it was a bad idea to make it this way, so I'll launch it as a private method.

Similar Messages

  • Objects with invalid references

    hello everybody,
    since 1 month in our PI dev we have a strange situation.
    Inside every SC we see a tree named "objects with invalid references" that inside cointain the Namespace.
    I notify we have this situation after a massive transport from PI prod to PI dev .
    we decide to do this because no more develop are necessary and we decided to sincronizate the 2 systems.
    It's possible remove this ?
    thanks
    Alessandro

    Hi
    Please check if the Prod and Dev SLD is sync and has all the SWC with same configuration.
    Please also check the dependency maintain in Prod and Dev SWC.
    refer the below discussion
    SWCV deleted from SLD accidently
    regards,
    Harish

  • New object (with string)

    Hello,
    I have a function which is getting as an input a string variable and needs to create an new object that has the same name as the input string.
    How can I do it?
    thanks

    Hello,
    I have a function which is getting as an input a
    string variable and needs to create an new object
    that has the same name as the input string.
    How can I do it?For me the main question is why you want to do this? What difference is the name of the as long as you can find the object. I wonder if there is a better way of implementing what it is you want to do.
    For instance, would tying your object to the string via HashMap be a better solution?
    Do you have any sample code or pseudocode showing what you want to do?
    Message was edited by:
    petes1234

  • GC of object with loopback references

    Can someone answer this please : when there is a loopback of object references that are created in a method scope, will the objects be GCed ? For example, suppose we have this situation of objects: A -> B -> C -> A and they are created in a method like this:
    public void foo() {
    A a = new A();
    B b = new B();
    C c = new C();
    a.set(b); //a has ref to b
    b.set(c); //b has ref to c
    c.set(a); //c has ref back to a
    When I come out of the foo() method, will the objects a, b and c be GCed ?

    radiatejava wrote:
    Can someone answer this please : when there is a loopback of object references that are created in a method scope, will the objects be GCed ? ...The short answer is yes. Cycles can be a problem for reference counting garbage collectors; however, I'm not aware of any mainstream JVM that uses a reference counting GC. Sun's JVMs (SE, ME, realtime) use tracing collectors, which are not affected by reference cycles.
    Python, on the other hand, uses a reference counting GC, so python programmers should avoid creating cyclic references.

  • BAPI_PO_CHANGE ADD NEW POSITIONS WITH AGREEMENT REFERENCE ACCOUNT ASSIG. U

    Hello, we are trying to add new positions to a MM orders
    using "BAPI_PO_CHANGE". The positions take into account an agreement number as reference and executing it, the bapi overwrites the value of the account asingment and sets 'U' instead of blank which is the value set as parameter in the field POITEM-ACCTASSCAT and shows the error message ME069 unknown account assignment.
    I tried to set in the bapi the value '*', for example, and the bapi returns correctly the message: This value doesn't exist as an account assingment category. I did this to confirm that the bapi substitutes the value set as parameter for the U value brought from the agreement. I need the same functionality but setting blank. I tried to create a blank entry as account assignment category but the bapi doesn't recogniced it.
    I have tried to code in the next points:
    Field exit KNTTP
    Includes ZXM06U41, ZXFMYU03, zxmewu09 and ZXMEWU11.
    In none of the mentioned cases we have changed the value 'U' for blank,
    because the system always runs before the function MEX_PSTYP_KNTTP where makes the check and shows the error message ME069 unknown account assignment.
    Thanks for your help.
    Jose Luis.

    Hi,
    please check the note 420332.
    If you want to add a new service line please use a dummy packno in the structures POITEM ,POSERVICES, POSRVACCESSVALUES.  A dummy packno means that it does not have any entries in the tables ESLL and ESLH yet. The best solution would be to choose a packno which is a very low number which is not occupied in esll and eslh.
    If you add a new service line please fill in first the father line into POSERVICES and add also the service line (2 entries), like it was described in note 420332, part 3.7
    Regards,
    Edit

  • All the references should Point to New Object.

    Hi..
    I have a problem with manipulating the references of an Object.
    Let me explain my problem,assume i have an object and that object is referred by some 5 references...
    Eg:
    class Box
    int x;
    Box b = new Box(5);
    Box a = b;
    Box c = b;
    Box d = b; etc.
    if i say d.x = 65; all the references x value is changed to 65
    Nuv I want to replace this Object with another new object with one of the references.
    b = new Box(10);
    here only b points to the new Object and all the references point to the same object,but I need all the references to point to this new object..at a stroke.Huv do i do it..(Note I need generic code..)this number of references can be more or less..,needless to say i want to work with references of an Object.Does any one know how to achieve it?
    Any help is appreciated
    Regards
    Siva

    You r rite.
    In fact I was tryinnn to do the same thing when I said
    d.x = 65;
    but assume u want to create a new object,not this one.(because in my application the object is not small..)
    then when u create the new object.and once that object is equated by
    one of the reference, other references still point to the original object. I dont know whether I m able to explain you clearly..

  • New Object Creation vs. Field Setters

    I know this is massively context dependent, but is there some rule of thumb to follow when it comes to deciding between
    i) Making an class's fields final and creating a new object with new field values when needed, and
    ii) Leaving a class's fields mutable and using setter methods to alter the field.
    I tend toward option one, because not only do I tend to shy away from setters, but also because it helps prevent me from accidentally maintaining an old reference. However, purely from a performance standpoint, which option should you assume is better? How many object's of X size do I have to be making per unit of time before the performance benefits of "final" are lost?
    Thanks!

    I've been wishing for a while that Java would add a language level concept of immutability. Either an immutable keyword or an annotation. The compiler would bitch if you declared a class immutable and each of its fields was not final and either a primitive or a reference to an immutable class. Or perhaps it could simply check that there was no assignment to any field.
    It would be handy for me as a user of a class to know that it's immutable, for things like copying and thread-safety. It might or might not allow for runtime optimizations too.
    As for whether to make a given class immutable, like others say--it depends on the semantics of the class. If it's intended to represent something dynamic--e.g. a clock, or a piece on a board whose position changes with time, or the state of a network interface including packet sent and received--then it will make your code clunky and nonintuitive if you have to create a new object everytime the state of the thing you're modeling changes. But if it's something that changes less frequently, or that represents a fairly static entity or "value", then make it immutable.
    I do agree with duffymo: Better that an object comes out of construction in a valid and useful state. So even if the object is mutable, pass field values to the c'tor or set them to reasonable defaults inside the c'tor (e.g., "now", etc.)

  • How to use property object with dequeue

    I tried to do following steps in Labview7.1 and Teststand3.1:
    - Create a named Queue in Teststand
    - Get the named Queue reference in Labview (GetQueue)
    - Enqueue an property of type NI_BatchControllerRequest into the Queue in Teststand
    - Dequeue the element in Labview by using a Fileglobal of type NI_BatchControllerRequest as destination property object
    At the first Enqueue, the object is correctly dequeued and stored in the Fileglobal. But at the next enqueue, I get the error -17300 (Exception occured in TSSync, Unable to set a top-level property object to another object) at the dequeue operation.
    When I use flat datatypes like string or bool, there are no errors, also at multiple enqueue operations.
    Can anyone help?

    LVFan -
    I did not realize that you are using the SyncManager low level API. The low-level API has a few restrictions that the step type does more work to hide from the user.
    If you look at the dequeue API function it takes an input parameter which is the destination object. Internally the dequeue operation uses the SetPropertyObject method to do the assignment. This method requires that the object that you assign a value to has a parent so that the engine can go to the parent, delete the child, and add the new child in its place. Even if the destination property object that you supplied had a parent, your reference to the "destination" would not be the new object because your reference is pointing to the old property a
    nd not the new one. You would be required to go to the parent and ask for the child again.
    A simple change to make this work for you is to use a reference object as the destination and then use GetValInterface on it to get the element from the queue. I have updated your VI to illustrate this.
    Scott Richardson (NI)
    Scott Richardson
    National Instruments
    Attachments:
    Queue.vi ‏93 KB

  • SCCM Client entry in SCCM console for new VM with same hostname

    HI,
    I have Hyper V server with several VM's running with server OS. Recently I have stopped 2 VM's with OS windows server 2008 & 2012 & recreated new VM's with same hostnames & IP addresses. Problem is I am unable to install SCCM client on New VM
    as old enrty lies in SCCM consle with client status Active. I tried to uninstall the client from console, But its showing "can not ping".
    So is it ok to simply delete this entry from console so new entry will come in front?

    Hi,
    You can delete the object in the SCCM Admin Console,you can also install the client manually and then they will register again creating a new object with the same name.
    Regards,
    Jörgen
    -- My System Center blog ccmexec.com -- Twitter
    @ccmexec

  • RegisterObjet (for a new object) return a clone form a different object

    Hello,
    when I register a new object with registerObject method, I sometimes receive an object from the same class but a clone from an other objet.
    How is that possible ?
    thanks
    Annabelle

    Hello Annabelle,
    When you call registerObject(someObject), TopLink will perform an existence check to see if the object passed in is new or existing, then return a working copy of the object passed in. It the object was previously registered, it will pass the same working copy back, otherwise, it will clone the object passed in to use as the working copy.
    Are you using sequencing?
    If registerObject is passing back the same working copy for multiple new objects, there might be a problem with the object's primary key - which is used for identity.
    Try printing off what is in the identity maps using the session.getIdentityMapAccessor().initializeIdentityMaps() api on the UnitOfWork. This should show all the objects in the cache as well as the primary keys they are cached under, which might help to identify the problem object and how it got in the cache.
    Best Regards,
    Chris

  • Issues when adding new objects

    A few questions regarding changes in Toplink from 2.5 to the current version.
    Say I had object A which contains a collection of Bs and a collection of Cs.
    Now when I want to save A and Bs and Cs to the database as an insert.
    Is the following code correct ?
    A a = new A();
    A cloneA = (A)uow.registerObject(a);
    Vector bCollectionClone = uow.registerAllObjects(new Vector(bCollection));
    Vector cCollectionClone = uow.registerAllObjects(new Vector(cCollection));
    uow.commit();
    This seemed to work in 2.5. According to the API java docs this should work even today.
    The reason I am asking is all of these -A, B and C are new objects. Should they be registered with registerNewObject();
    Is it incorrect to register a new object with cloning ?

    I forgot to add a couple of lines of code to that snippet
    A a = new A();
    A cloneA = (A)uow.registerObject(a);
    Vector bCollectionClone = uow.registerAllObjects(new Vector(bCollection));
    Vector cCollectionClone = uow.registerAllObjects(new Vector(cCollection));
    cloneA.setBCollection(bCollectionClone);
    cloneA.setCCollection(cCollectionClone());
    uow.commit();
    A few questions regarding changes in Toplink from 2.5
    to the current version.
    Say I had object A which contains a collection of Bs
    and a collection of Cs.
    Now when I want to save A and Bs and Cs to the
    database as an insert.
    Is the following code correct ?
    A a = new A();
    A cloneA = (A)uow.registerObject(a);
    Vector bCollectionClone = uow.registerAllObjects(new
    Vector(bCollection));
    Vector cCollectionClone = uow.registerAllObjects(new
    Vector(cCollection));
    uow.commit();
    This seemed to work in 2.5. According to the API java
    docs this should work even today.
    The reason I am asking is all of these -A, B and C
    are new objects. Should they be registered with
    registerNewObject();
    Is it incorrect to register a new object with cloning

  • 2d object with multiple primitive types

    I've done some research and tried a few options and finally decided that I want a two dimensional object to handle several different types of primitives. My current plan is to just put them all in a 2d String array, then parse them to whatever type I need when I need to do calculations with the integers or doubles. But I also wanted to ask if there was already an object type that could handle this for me without the parsing. I need more than one value per key, so I don't think that a map will work (although I've admittedly never used one before and may not fully understand how it operates).
    My other thought was to just make a new object with several different arrays of different types and to use the indices to relate one to another. This would at least clean up my code and take out some repetitive parsing steps, but it seems a very roundabout way to handle the situation.
    Any suggestions?
    Should I just use a 2d String array?
    Should I make a new object?
    Does an object already exist for this application?
    Also, if I muddied any of this up by using improper word choice, please let me know so that I can try to clarify.

    Fair enough. I'm working on analyzing some data for a videogame. I want to find the optimal set of items on a character by trying every combination and analyzing it's effectiveness. In order to do this, I want to store about a dozen different stats (some integers, some doubles) for about 30 different items along with the item's name, then use some nested loops to evaluate each combination. There is no 'perfect answer', so I need to perform this process multiple times under varying circumstances. I figure this would be easiest to accomplish if every stat is associated with an x value and every item is associated with a y value because I could then use the index of a for loop to process the information.
    In short, I have several different data types that I want to store in a manner that allows me to load and retrieve all the information using loops. Each set of data has the exact same format (String, int, int, double, double, double...).
    I know it doesn't sound like an important project, but I like to take any opportunity I can to practice my programming. I think it's an important skill in today's world and I'm always trying to improve.

  • Inserting a new row in a BC4J View Object with an attribute of type BFileDomain

    Hi all,
    I've to insert a row in a View Object with an attribute of type oracle.jbo.domain.BFileDomain.
    I do this within an Application Module's method, which has an input parameter of type byte[]. This parameter will be the content of the BFILE.
    What's the right way for doing that?
    I've tried with the following code, but I've got an exception in committing the transaction:
    public int serializeDocument(int codDomanda, int codSorgente, byte[] content, String est, int type, int cost, String title, String arg) throws JboException {
    int code = 0;
    //File f;
    DocumentiTwoView = getDocumentiTwoView();
    java.sql.Statement stmt = ((DBTransaction) getTransaction()).createStatement(1);
    try {
    Row docRow = DocumentiTwoView.createRow();
    SequenceImpl seq = new SequenceImpl("documenti_seq", getDBTransaction());
    Integer next = (Integer) seq.getData();
    code = next.intValue();
    docRow.setAttribute("Coddocumento", new Number(code));
    docRow.setAttribute("Titolo", (String) title);
    docRow.setAttribute("Argomento", (String) arg);
    docRow.setAttribute("Costo", new Number(cost));
    docRow.setAttribute("Tipo", new Number(type));
    docRow.setAttribute("Coddomanda", new Number(codDomanda));
    docRow.setAttribute("Codsorgente", new Number(codSorgente));
    //f = new File("Doc" + code + "." + est)
    BFILE src_lob = null;
    ResultSet rset = null;
    rset = stmt.executeQuery ("SELECT BFILENAME('DOC_DIR', 'Doc" + code + "." + est + "') FROM DUAL");
    if (rset.next()) {
    src_lob = ((OracleResultSet)rset).getBFILE(1);
    BFileDomain bfd = new BFileDomain(src_lob);
    bfd.setBytes(content);
    bfd.saveToDatabase(getTransaction());
    docRow.setAttribute("Contenuto", (BFileDomain) bfd);
    catch (Exception ex) {
    getTransaction().rollback();
    throw new oracle.jbo.JboException("Impossibile creare il nuovo documento:\n" + ex.getMessage());
    finally {
    try {
    stmt.close();
    catch (Exception nex) {
    try {
    // Commit the whole transaction
    getTransaction().commit();
    catch (Exception e) {
    e.printStackTrace();
    getTransaction().rollback();
    throw new JboException("Impossibile eseguire il commit della transazione:\n" + e.getMessage());
    return code;
    Thanks a lot in advance!
    Christian
    null

    Odd, have you disabled caching and indirection? (NoIdentityMap, dontUseIndirection, or alwaysRefresh/disableCacheHits). If so, then this could be the issue.
    Otherwise please include the sample code you use to perform this, and verify that you do not have any unusual code in your set/get methods or in descriptor events. Also turn TopLink logging on and include a sample. Also ensure that you do not modify your objects until after registering them in the unit of work, and only modify the unit of work clones.

  • Resolved reference placed in object with no cache

    Hi ,
    I have been seeing this error in my weblogic logs.The workflows are
    running fine and doing intended work. Have a look at the error message
    WARNING: Resolved reference placed in object with no cache.
    java.lang.Exception: printStackTrace
            at com.waveset.util.Util.printStackTrace(Util.java:6259)
            at com.waveset.object.PersistentObject.cacheWarning(PersistentObject.java:476)
            at com.waveset.object.PersistentObject.checkReference(PersistentObject.java:2683)
            at com.waveset.object.PersistentObject.checkReferences(PersistentObject.java:2718)
            at com.waveset.object.PersistentObject.addMemberObjectGroup(PersistentObject.java:1513)
            at com.waveset.workflow.WorkflowEngine.buildWorkItem(WorkflowEngine.java:4406)
            at com.waveset.workflow.WorkflowEngine.callManualAction(WorkflowEngine.java:4284)
            at com.waveset.workflow.WorkflowEngine.callAction(WorkflowEngine.java:3811)
            at com.waveset.workflow.WorkflowEngine.callAction(WorkflowEngine.java:3229)
            at com.waveset.workflow.WorkflowEngine.execute(WorkflowEngine.java:3070)
            at com.waveset.workflow.WorkflowEngine.makeTransition(WorkflowEngine.java:2809)
            at com.waveset.workflow.WorkflowEngine.checkExplicitTransitions(WorkflowEngine.java:2700)
            at com.waveset.workflow.WorkflowEngine.checkTransitions(WorkflowEngine.java:2486)
            at com.waveset.workflow.WorkflowEngine.processSteps(WorkflowEngine.java:1891)
            at com.waveset.workflow.WorkflowEngine.walkCases(WorkflowEngine.java:1748)
            at com.waveset.workflow.WorkflowEngine.walkCases(WorkflowEngine.java:1656)
            at com.waveset.workflow.WorkflowEngine.execute(WorkflowEngine.java:816)
            at com.waveset.workflow.WorkflowEngine.execute(WorkflowEngine.java:478)
            at com.waveset.workflow.WorkflowExecutor.execute(WorkflowExecutor.java:235)
            at com.waveset.task.Scheduler.execute(Scheduler.java:2393)
            at com.waveset.task.Scheduler.executeTask(Scheduler.java:2295)
            at com.waveset.task.TaskManager.executeTask(TaskManager.java:277)
            at com.waveset.workflow.Workflow.checkinWorkItem(Workflow.java:378)Any Ideas,
    Thanks

    Did anybody resolve this issue?
    I am getting com.waveset.util.WavesetException:Class com.omd.session.WorkflowServices not found.
    It seems the workflow status shows finished, but did not start the acctual workflow process of approvals and emails to the appropriate user accounts.
    Anybody has any clues about this exception?
    G

  • EEWB: Insert New Table with more than one key field  for BP object

    Hi Gurus,
    I want to enhance Business Partner object with a new table with two key fields, one the address number and another a sequence number, because I need to save several entries for each address belonging to a determined business partner. Something as what happens in communication data (i.e fax number)for an address.
    I have run the wizard from EEWB but the only possibility that offers you is to create only one key field for the new custom table. There is something in EEWB to achieve this, two key fields for the new table?
    Another question is the following: which Badi or BAPI must I enhance to populate my table with the corresponding address number to which the data belong to?
    I mean my custom data are filled through a table control that I have allocated within the screen sequence BUA130 (Detail Address). Thus, when a new address is added to a BP and my particular table control is populated within this address I should fill the key fields from my table (address number and sequence number) when the BP were saved. So, I must know beforehand which address number the system will assign to this new address.
    I repeat the question: which Badi or BAPI must I enhance to populate my table with the corresponding address number to which the data belong to?
    Thanks in Advance.
    Regards,
    Rosa Ferrando

    Hi Rosa,
    Please go through the following links. It will help you.
    <a href="http://help.sap.com/saphelp_crm50/helpdata/en/20/a4ffee7e0fcc4ebb7e5466d3903d38/frameset.htm">http://help.sap.com/saphelp_crm50/helpdata/en/20/a4ffee7e0fcc4ebb7e5466d3903d38/frameset.htm</a>
    <b>Reward points if it helps.</b>
    Regards,
    Amit Mishra

Maybe you are looking for