Can method return before body is executed?

In JLS section 8.1.3.4
http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#36930
"This prevents method one and method two from being executed concurrently, and furthermore guarantees that the shared values of i and j are both updated before method one returns."
Does this imply that without synchronization, method one could return before the expressions i++ and j++ are evaluated?
If so, would you please explain how this can happen?

In JLS section 8.1.3.4
http://java.sun.com/docs/books/jls/second_edition/html/
lasses.doc.html#36930
"This prevents method one and method two from being
executed concurrently, and furthermore guarantees that
the shared values of i and j are both updated before
method one returns."
Does this imply that without synchronization, method
one could return before the expressions i++ and j++
are evaluated?The expressions are evaluated before method one returns. However the results might not be visible in method two for quite some time after method one returns. And the order that they are updated (from the point of view of the thread running method two) could be different than one would expect.

Similar Messages

  • Report execute time nd how many records will be returned before hitting the "run" option?

    Post Author: Prasad15
    CA Forum: WebIntelligence Reporting
    Is there any way to know how long the report executes and how many records will be returned before hitting the "run" option?
    Regards
    Prasad

    To know if the report is going to return more than 10,000 records, you first have to run the query with a 'select count(1) from ... where ...' (with the same from and where clauses as you normal query). Since this takes about the same time as runnng your report, I wonder if you really gain anything (although formatting may take some time too).
    You may simplify the select count(1) query by omitting all the lookup tables that are only needed for formatting. That way your query may run a lot faster. You can put this in your after parameter form trigger.

  • The class of the deferred-methods return type "{0}" can not be found.

    I am developing a multilingual portal application.
    I have the method that changes the locale based on user's choice in the bean and the method is being referred to as below.
    <af:selectOneChoice label="Select Language" autoSubmit="true"
    value="#{localeBean.locale}"
    valueChangeListener="localeBean.changeLocale">
    <af:selectItem label="English" value="en" id="si1"/>
    <af:selectItem label="French" value="fr" id="si2"/>
    <af:selectItem label="Dutch" value="nl" id="si3"/>
    </af:selectOneChoice>
    when i try to run the application, i am getting compile time errors as below,
    The class of the deferred-methods return type "{0}" can not be found.
    No property editor found for the bean "javax.el.MethodExpression".
    After going through the discussion forums i learned that the compilation errors can be resolved by setting the <jsp:directive.page deferredSyntaxAllowedAsLiteral="false> at the starting of the page.
    Even after that i am getting the compilation error.
    Any solutions, suggestions or possible approaches would be helpful as i am new to Webcenter Portal development.
    Thanks,

    The error you get points to a problem on the page (somewhere). Switch to source mode and check the right margin if you see orange or red marks. These are pointing to problems (not all are show stoppers, but they give you hints that something is not according to the standard for jsf, jsff, jsp or jspx pages.
    Have you checked that the bean is correctly defined and that it's reachable?
    Start a fresh page and isolate the problem, e.g. build a selectOneChoiuce on the new page (don't copy it as you might copy the error too) and make it work on the new page. Once you have it running you can compare the solution to your not running page.
    Timo

  • Can a method return a class ?

    hi,
    i have a simple question.
    can a method return class value ?
    in the below script i did'nt understand the commented line.
    package com.google.gwt.sample.stockwatcher.client;
    import com.google.gwt.user.client.rpc.RemoteService;
    import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
    @RemoteServiceRelativePath("login")
    public interface LoginService extends RemoteService {
      public LoginInfo login(String requestUri);  //What is this ? is this a sample of what i asked ?
    }

    The answer to your question is yes.
    The idea is that an object calls a function of another object (passing in objects to the function as arguments) in which that object returns an object (note the arguments or returned value of the function may alternately be primitive types). Each object typically encapsulates data and provides a rich set of functions to the calling object so that calling object doesn't have to deal with the raw data directly. Therefore, not only does the calling object get the data it wants, but also a rich set of functions that can manipulate that data.
    Example:
    Book book = new Book();
    int characterCount = book.getChapter(3).getParagraph(4).getSentence(12).getWord(8).getCharacterCount();
    In the above, each object (Book, Chapter,Paragraph,Sentence,Word) has a rich set of functions it provides to its caller.
    Example: the Sentence Object has a collection of word objects (raw data). Functions it provides to Paragraph object are:
    Word getWord(int index), Words getWords(), int getWordCount().
    If you haven't already done so, I suggest reading a book on Java from cover to cover to pick up such Object Oriented concepts.

  • [svn:fx-4.x] 15186: In RichEditableText handlePasteOperation() if there are no constraints (maxChars, restrict or displayAsPassword) and multiline text is allowed we can do an immediate return before the text is extracted from the text flow .

    Revision: 15186
    Revision: 15186
    Author:   [email protected]
    Date:     2010-03-31 16:42:19 -0700 (Wed, 31 Mar 2010)
    Log Message:
    In RichEditableText handlePasteOperation() if there are no constraints (maxChars, restrict or displayAsPassword) and multiline text is allowed we can do an immediate return before the text is extracted from the text flow.  This should be the typically case when pasting large amounts of text.
    QE notes:
    Doc notes: None
    Bugs: partial fix for SDK-25793
    Reviewed By: Gordon
    Tests run: checkintests
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-25793
    Modified Paths:
        flex/sdk/branches/4.x/frameworks/projects/spark/src/spark/components/RichEditableText.as

    Step by step, how did you arrive at seeing this agreement?

  • Can a method return multiple items

    Can a method return more than one thing?
    I want to have a method return a boolean and a String. My method is saying if something is right or wrong, then its saying the reason why.
    help, please.
    Thanx

    Afternoon_Delight wrote:
    My question is:
    Is there a way so that it can be more like this:
    public boolean, String checkValidity (){
    To expand on the previous posts, one way (not saying it's the best one!) is to create an object that combines the information that you want returned:
    public class MyValid
      private boolean valid;
      private String text;
      public MyValid(boolean valid, String text)
        this.valid = valid;
        this.text = text;
      public boolean isValid()
        return valid;
      public String getText()
        return text;
    class DoFoo
      public MyValid checkValidity()
        return new MyValid(false, "Because I said so!");
    }

  • How come Java methods can only return one variable?

    Hi,
    I am just curious, how come C/C++/Java methods/functions can only return one argument but can accept many parameters.
    I know that the workaround is to return an object, but sometimes creating a class is just too much overhead.
    Thank you in advance.

    Hello,
    It's an interesting discussion. To get the full answer to your question, you'd have to consult the library and find books on programming language design and implementation.
    I believe the tradition goes all the way back to the first programming languages having subroutines/procedures/functions/methods in them: you can return nothing at all (void i Java) or a single value. The need for returning a single value, I guess, comes from the wish to embed calls in arithmetic expressions:
      res = 2 * someObject.foo(x) - anotherObj.bar(a,b);To my knowledge, few languages allow you to return more values. One that does is BETA (see www.daimi.au.dk/~beta/). Though not indispensable, it's convenient sometimes. I don't know why it's not more widespread.
    Yours,
    Ole

  • How can I return in a native method a Java type?

    Hi,
    i want to return in the native methode ja Java type java.awt.Dimension!
    How can I do this?
    Java code:--------------------------------------------------------------------------------
    public native java.awt.Dimension getSize()
    generating the JNI header file
    JNI header code:--------------------------------------------------------------------------------
    JNIEXPORT jobject JNICALL Java_Video_getSize(JNIEnv *, jobject)
    my c function looks like this
    code:--------------------------------------------------------------------------------
    JNIEXPORT jobject JNICALL Java_Video_getSize(JNIEnv *env, jobject obj)
    return ???????
    how can I return in C an object like jawa.awt.Dimension?
    Thx
    Ronny

    Here is my 2 cents for a way we pass data between Java and C via the Java Native Interface. This excerpt is an example of passing an int value through a locally created Integer wrapper class, which must be adapted for local use. Note that because of the wrapper, return values are not needed.
    1. Create the Java class file.
    * This class encapsulates a Java <CODE>int</CODE> primitive.
    * This class was created to allow programmers to change
    * the value of an existing integer object without being
    * forced to create a new object (as is the case with the
    * Java Integer object).
    public class LocalInteger
         private int     value;
         * Creates a LocalInteger object and initializes
         * it to <I>0</I> (the default in Java).
         public LocalInteger ()
              super ();
         * Creates a LocalInteger object and initializes
         * it using the given <I>int</I> value.
         * @param i Integer value to use in initializing
         * the object.
         public LocalInteger (int i)
              super ();
              value = i;
         * Gets the value of the object.
         * @return The value of the object.
         public int getValue ()
              return (value);
    2. Create the jni header file.
    DLL_EXTERN void jni_GetValue_from_LocalInteger(int* LocalInteger, JNIEnv *env, jobject thisLocalInteger);
    3. Create the C file.
    /*start of jni header****************************************
    *NAME/TITLE:       jni_GetValue_from_LocalInteger
    *DESCRIPTION:      This routine copies the integer value
    * from the Java LocalInteger object to the
    * C 'int' variable.
    *CALLING SEQUENCE: jni_GetValue_from_LocalInteger (LocalInteger,
    * env,
    * thisLocalInteger)
    *PARAMETERS:
    * Type Name I/O Description
    * int * LocalInteger I/O C variable
    * JNIEnv * env I JNIEnv pointer
    * jobject thisLocalInteger I Java object
    *RETURN:           N/A
    **end of header*********************************************/
    /* ********************** BEGIN CODE ********************** */
    DLL_EXPORT
    void jni_GetValue_from_LocalInteger(int* LocalInteger, JNIEnv *env, jobject thisLocalInteger)
         LocalInteger = (int) (env)->GetIntField(env, thisLocalInteger, LocalInteger_Value);

  • HT1657 How can I return a rental movie before watching it and get my money back?

    I rented a movie on iTunes on my MacBook Pro and no longer want to watch it. Can I return it for my money back?

    No

  • Can java method return  multiple values

    hey , I need big favor can i return two arrays in a single function

    Not directly no.
    But there are ways around it.
    You can create a "result object" which has attributes being the two arrays, and return that object (ie wrap the arrays in another object)
    You could put the arrays into a collection (eg ArrayList/Vector) and then return that object. You can then retrieve the two arrays as the first two items in that list.
    Either of those should work, even if they are hacks ;-)
    Cheers,
    evnafets

  • HELP! Last second extra credit (before midnight), how can i return the node

    While traversing a tree... How can i return the node I am currently at?

    Or perhapspublic Node getCurrentNode() {
      return currentNode;
    }Your question has a large number of possible interpretations.

  • Can I return my iPhone 6 and go back to my 5?

    Hi folks,
    I mail-ordered an iPhone 6 because my current phone's a 5, and I've been doing the every-other-generation dance since my first iPhone, a 3G. For the very first time, though, I think I regret my upgrade. I'm probably going to allow a few days to get used to this new, big phone, but I feel doubtful.
    My question, then: is there a way I can say "Ha ha oops never mind", switch my US AT&T service back to my 5, and return the 6? My best guess based on experience is that Apple would take the phone back in 30 days (at least they do that with Mac purchases), and AT&T would be happy to fine me $150 for early-termination on my old phone and sign me up for a new two-year commitment on my old one, again. Which would be kind of awful.
    Is there a better way, or do I just have to see this as an expensive life lesson?
    Motivation: I find the 6 very uncomfortable to hold and use one-handed, and I have no desire for a larger screen if the tradeoff is that I am obliged use this device two-handed now. I feel quite frustrated every time I need to tap any screen's "Back" button, now physically out of my thumb's reach way up there at the top of the screen. Double-tapping the home button to push the top controls within reach feels like an ugly hack, and reminds me every time I do it that this phone is larger than I'd like it to be. Perhaps most worrying of all, I find myself unable to keep my wrist straight while holding this bigger, heavier phone, and I can feel my nascent RSI tingling while I'm trying to read a book on it. Add all these up and you have the very first time I'm using a new iPhone and am not just not in love with it, but really alarmed and half-panicking that this essential life-tool doesn't even feel like it fits with my body any more.
    So yeah. Pretty sure I wanna go back to the light, wonderful 5. Any advice would be appreciated.

    In the exact same boat here. Life-long iPhone user. Got a 6 on Tuesday and absolutely hate it to the point where I dread using it. Upgraded from an iPhone 4 I'd had for 4+ years. After making several phone calls, my understanding is that Apple will take it back no problem, within 14 days. My iPhone 4 was out of contract with AT&T but when I bought the 6, I renewed my previous contract for 2 years. My AT&T contract also has a 14 days, cancel for any reason with no early termination fee, clause. I assume your AT&T contract would have the same. But I don't think you need to worry about canceling your contract. Since you still have your iPhone 5, you should be able to bring it to the AT&T store, have them switch the existing contract from the 6 to your old 5 and then you can go return the 6 to the Apple store where you bought it. That's no different than being halfway through a two year contract, your phone is stolen and you have to buy a new one at retail price to replace it on your existing contract. You're essentially just bringing your own device you already paid for (the 5) to the existing AT&T plan.
    I would just caution that assuming you want to keep your phone number, get the service put back on your 5 at AT&T and have them deactivate the 6 before you go return the 6. Or just make sure the Apple store is capable of transferring the service from the 6 back to the 5 while you're there to do the 6 return.

  • WSIF - Can we return java class back to bpel (PLEASE HELP)

    Scenario : We have old project and migrating to Oracle BPEL.
    In this project we have Java Files and inside that java files we have many functions which return java object. Is it possible to return java value object to bpel process.
    Steps which i have followed:
    1. Created a WSDL file using the control file given below.
    2. Changed the name spaces and types generated to XFMFRq and TXNLog as i/p and o/p.
    3. Imported same file into oracle bpel.
    4. Called the function : logbegin.
    EXCEPTION : The types are not compactable is the exception we are getting but we are able to call the function and execute first line but not able to return TXNLOG class as an xml element to bpel.
    For Example :
    1. Java Method and this method returns Java Value Object
    Java Control which has TXNLOG as the value object which will return the value.
    CONTROL FILE
    public TxnLog logBegin(com.hp.rtfs.xfmf.doc.XFMFRqDocument requestXML)throws Exception
    //LogUtil.logDebug(LogConstants.MODULE_BPM,BPM_CONTROL_NAME,"Enter Method logBegin ");
    txnLog=new TxnLog();
    try
    System.out.println("AMMA1121212");
    LogUtil.logDebug(LogConstants.MODULE_BPM,BPM_CONTROL_NAME,"Entering Top user id update in LogBegin");
    txnLog.setTlogChannelLoginId("AMMA1");
    txnLog.setTlogChannelUserId("AMMA2");
    System.out.println("AMMA2");
    txnLog.setTlogChinChannelId("ATM");
    txnLog.setTlogChannelSessionId("SESSION-1111");
    System.out.println("AMMA3");
    txnLog.setTlogCustCifKey((new Long("121212")));
    txnLog.setTlogEmtnTxnCd("TXN-001");
    System.out.println("AMMA4");
    txnLog.setTlogSendIpAddr("10.1.1.1");
    txnLog.setTlogChannelTxnSeqId(new Integer("1212"));
    System.out.println("AMMA5");
    TxnLogPK txnLogPk=new TxnLogPK(new Integer("121212"),
    DateUtil.getDate(requestXML.getXFMFRq().getMsgRqHdr().getUID().getRTFSTransSeqUIDDt()),"1212");
    txnLog.setTxnLogPK(txnLogPk);
    System.out.println("AMMA6");
    catch(Exception e)
    //LogUtil.logError(LogConstants.MODULE_BPM,BPM_CONTROL_NAME,"Exception "+e.getMessage());
    e.printStackTrace();
    return txnLog;
    TXN LOG value object is :
    // Oracle JDeveloper Stub Generated Source
    package com.hp.rtfs.ods.infra.trx;
    public class TxnLog
         implements java.io.Serializable
         // Constructors
         public TxnLog(com.hp.rtfs.ods.infra.trx.TxnLogPK p1, java.lang.Long p2, java.lang.String p3, java.util.Calendar p4, java.lang.String p5, java.lang.String p6, java.lang.String p7, java.lang.String p8, java.lang.String p9, java.lang.Integer p10, java.util.Calendar p11, java.lang.String p12, com.hp.rtfs.ods.infra.channel.ChannelInfo p13, java.util.Set p14) { }
         public TxnLog() { }
         public TxnLog(com.hp.rtfs.ods.infra.trx.TxnLogPK p1, java.util.Set p2) { }
         // Fields
         private com.hp.rtfs.ods.infra.trx.TxnLogPK TxnLogPK;
         private java.lang.Long tlogCustCifKey;
         private java.lang.String tlogEmtnTxnCd;
         private java.util.Calendar tlogStartDt;
         private java.lang.String tlogStat;
         private java.lang.String tlogSendIpAddr;
         private java.lang.String tlogChannelUserId;
         private java.lang.String tlogChannelLoginId;
         private java.lang.String tlogChannelSessionId;
         private java.lang.Integer tlogChannelTxnSeqId;
         private java.util.Calendar tlogEndDt;
         private java.lang.String tlogChinChannelId;
         private com.hp.rtfs.ods.infra.channel.ChannelInfo channelInfo;
         private java.util.Set txnLogDatas;
         // Methods
         public com.hp.rtfs.ods.infra.trx.TxnLogPK getTxnLogPK() { }
         public void setTxnLogPK(com.hp.rtfs.ods.infra.trx.TxnLogPK p1) { }
         public java.lang.Long getTlogCustCifKey() { }
         public void setTlogCustCifKey(java.lang.Long p1) { }
         public java.lang.String getTlogEmtnTxnCd() { }
         public void setTlogEmtnTxnCd(java.lang.String p1) { }
         public java.util.Calendar getTlogStartDt() { }
         public void setTlogStartDt(java.util.Calendar p1) { }
         public java.lang.String getTlogStat() { }
         public void setTlogStat(java.lang.String p1) { }
         public java.lang.String getTlogSendIpAddr() { }
         public void setTlogSendIpAddr(java.lang.String p1) { }
         public java.lang.String getTlogChannelUserId() { }
         public void setTlogChannelUserId(java.lang.String p1) { }
         public java.lang.String getTlogChannelLoginId() { }
         public void setTlogChannelLoginId(java.lang.String p1) { }
         public java.lang.String getTlogChannelSessionId() { }
         public void setTlogChannelSessionId(java.lang.String p1) { }
         public java.lang.Integer getTlogChannelTxnSeqId() { }
         public void setTlogChannelTxnSeqId(java.lang.Integer p1) { }
         public java.util.Calendar getTlogEndDt() { }
         public void setTlogEndDt(java.util.Calendar p1) { }
         public java.lang.String getTlogChinChannelId() { }
         public void setTlogChinChannelId(java.lang.String p1) { }
         public com.hp.rtfs.ods.infra.channel.ChannelInfo getChannelInfo() { }
         public void setChannelInfo(com.hp.rtfs.ods.infra.channel.ChannelInfo p1) { }
         public java.util.Set getTxnLogDatas() { }
         public void setTxnLogDatas(java.util.Set p1) { }
         public java.lang.String toString() { }
         public boolean equals(java.lang.Object p1) { }
         public int hashCode() { }
    ---------------------------------------------------------------------------

    I have been bragging to my clients the benefits of
    Java Applications, but one thing I couldn't convince
    them is the use of a JVM. They dislike the idea of
    downloading the JRE, and the slowness of programs
    running in an interpreter. I am stumped for not being
    able to satisfy their need for a .EXE program on their
    Win32 systems. And, it would be ridiculous to go back
    again to C++, after learning Java. I'm not going to address the JRE distribution as it's already been mentioned and there are several ways of approaching that problem that you can find easily in the forum so I won't waste space for it here.
    What you need to address more than anything is the supposed slowness of java programs. The question at hand is slow as compared to what? In what context? A benchmark can be twisted to show whatever the author of the report wants it to show. Thus I tend to distrust such statistics in general due to the economical influence of the author or comissioner of the report being in the business of trying to sell something. Exactly what are they calling slow and what causes this perception on their part? I wouldn't sidestep the issue, or try to B.S. about it, but I'd be willing to bet that their fears are unfounded and based on superstition and hearsay.
    >
    Is their a tool or a way to convert .CLASS files into
    .EXE(Win32) files, to make it execute faster and
    independent? I know it would sacrifice portability,
    but I have to give in to demands. As they say it,
    "The customers are always right." Please, anybody out
    there, shed some light for me on this one. Thanx in
    advance.
    BlueKnyght.ph

  • Can't create SOAP body

    I've taken the schema for SOAP and can create an envelope, a header and a body
    with no data content. But now I can't add content; I can't create put anything
    in the body.
    It appears you can only set a Body with a Body object, but I want to put my XML/string
    into the body. Seems easy in theory, but I can't figure out how to do it. I tried
    parsing the content using a BodyDocument, but that created a fragment and I got
    weird errors:
    XmlValueNotNillableException
    or
    Tree copy contents NYI
    Help!
    Ken.

    I think all my problems were because I had old xmlBeans and interfaces. Simple
    set() methods worked, but any attempt to set a complex type failed. I just recompiled
    my schemas and tried again and it worked. The new beans have addNewXXX() methods;
    the old beans had ensureXXX() methods. Now I'm cooking with gas. ;->
    Ken.
    "Ken Kress" <[email protected]> wrote:
    >
    Eric,
    Samir passed along the suggestion to call the addBody method, but
    there is no such method in the soap interfaces I have.
    I got the schema for SOAP from: http://www.w3.org/2001/09/soap-envelope
    and compiled it. The interfaces the Body portion only list Factory methods
    of
    newInstance, parse, load, newValidatingXMLInputStream and coerce.
    The envelope has ensureBody and setBody methods, but I haven't figured
    how how
    to use them. For instance, if I do this:
    envelope.ensureHeader();
    Body tmpBody = envelope.ensureBody();
    // add the Body
    envelope.setBody( tmpBody );
    I get:
    Exception in thread "main" java.lang.RuntimeException: Tree copy contents
    NYI
    at com.bea.xbean.values.XmlObjectBase.set(XmlObjectBase.java:1480)
    at com.bea.xbean.schema.ComplexTypeMethodHandler.invoke(ComplexTypeMetho
    dHandler.java:512)
    at com.bea.xbean.schema.SchemaTypeImpl.executeComplexTypeMethod(SchemaTy
    peImpl.java:1552)
    at com.bea.xbean.values.XmlObjectBase.invoke(XmlObjectBase.java:1030)
    at $Proxy1.setBody(Unknown Source)
    at MMIMain2.buildEnvelope(MMIMain2.java:129)
    at MMIMain2.printLogonRequest(MMIMain2.java:89)
    at MMIMain2.main(MMIMain2.java:70)
    The same thing happens if I try to create my own body and then use setBody.
    Ken.
    "Eric Vasilik" <[email protected]> wrote:
    Sounds like you may want to use XmlCursor. If you get the XmlObject
    corresponding
    to the body, call newCursor(). This will return an XmlCursor whichcan
    be positioned
    insode the body (it is initiall positioned just outside the body). Then,
    create
    another cursor on the content you want to place inside the body andcall
    move()
    or copy() on the source cursor, passing the destination cursor. This
    will move/copy
    the stuff you want in the body to the body.
    "Ken Kress" <[email protected]> wrote:
    I've taken the schema for SOAP and can create an envelope, a headerand
    a body
    with no data content. But now I can't add content; I can't create put
    anything
    in the body.
    It appears you can only set a Body with a Body object, but I want to
    put my XML/string
    into the body. Seems easy in theory, but I can't figure out how to
    do
    it. I tried
    parsing the content using a BodyDocument, but that created a fragment
    and I got
    weird errors:
    XmlValueNotNillableException
    or
    Tree copy contents NYI
    Help!
    Ken.

  • Why there is implicit commit before and after executing DDL Statements

    Hi Guys,
    Please let me know why there is implicit commit before and after executing DDL Statements ?
    Regards,
    sushmita

    Helyos wrote:
    This is because Oracle has design it like this.Come on Helyos, that's a bit of a weak answer. :)
    The reason is that it makes no sense to update the structure of the database whilst there is outstanding data updates that have not been committed.
    Imagine having a column that is VARCHAR2(50) that currently only has data that is up to 20 characters in size.
    Someone (person A) decides that it would make sense to alter the table and reduce the size of the column to varchar2(20) instead.
    Before they do that, someone else (person B) has inserted data that is 30 characters in size, but not yet committed it.
    As far as person B is concerned that insert statement has been successful as they received no error, and they are continuing on with their process until they reach a suitable point to commit.
    Person A then attempts to alter the database to make it varchar2(20).
    If the database allowed that to happen then the column would be varchar2(20) and the uncommitted data would no longer fit, even though the insert was successful. When is Person B going to find out about this? It would be wrong to tell them when they try and commit, because all their transactions were successful, so why should a commit fail.
    In this case, because it's two different people, then the database will recognise there is uncommitted transactions on that table and not let person B alter it.
    If it was just one person doing both things in the same session, then the data would be automatically committed, the alter statement executed and the person informed that they can't alter the database because there is (now) data exceeding the size they want to set it to.
    It makes perfect sense to have the database in a data consistent state before any alterations are made to it, hence why a commit is issued beforehand.
    Here's something I wrote the other day on the subject...
    DDL's issue a commit before carrying out the actual action
    As long as the DDL is syntactically ok (i.e. the parser is happy with it) then the commit is issued, even if the actual DDL cannot be executed for another reason.
    Example...
    We have a table with some data in it...
    SQL> create table xtest as select rownum rn from dual;
    Table created.
    SQL> select * from xtest;
            RN
             1We then delete the data but don't commit (demonstrated by the fact we can roll it back)
    SQL> delete from xtest;
    1 row deleted.
    SQL> select * from xtest;
    no rows selected
    SQL> rollback;
    Rollback complete.
    SQL> select * from xtest;
            RN
             1
    SQL> delete from xtest;
    1 row deleted.
    SQL> select * from xtest;
    no rows selectedSo now our data is deleted, but not committed, what if we issue a DDL that is syntactically incorrect...
    SQL> alter tab xtest blah;
    alter tab xtest blah
    ERROR at line 1:
    ORA-00940: invalid ALTER command
    SQL> rollback;
    Rollback complete.
    SQL> select * from xtest;
            RN
             1... the data can still be rolled back. This is because the parser was not happy with the syntax of the DDL statement.
    So let's delete the data again, without committing it, and issue a DDL that is syntactically correct, but cannot execute for another reason (i.e. the database object it refers to doesn't exist)...
    SQL> delete from xtest;
    1 row deleted.
    SQL> select * from xtest;
    no rows selected
    SQL> truncate table bob;
    truncate table bob
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> rollback;
    Rollback complete.
    SQL> select * from xtest;
    no rows selectedSo, there we have it. Just because the statement was syntactically correct, the deletion of the data was committed, even though the DDL couldn't be performed.
    This makes sense really, because if we are planning on altering the definition of the database where the data is stored, it can only really take place if the database is in a state where the data is where it should be rather than being in limbo. For example, imagine the confusion if you updated some data on a column and then altered that columns datatype to be a different size e.g. reducing a varchar2 column from 50 character down to 20 characters. If you had data that you'd just updated to larger than 20 characters whereas previously there wasn't, then the alter table command would not know about it, would alter the column size and then the data wouldn't be valid to fit whereas the update statement at the time didn't fail.
    Example...
    We have a table that only allows 20 characters in a column. If we try and insert more into that column we get an error for our insert statement as expected...
    SQL> create table xtest (x varchar2(20));
    Table created.
    SQL> insert into xtest values ('012345678901234567890123456789');
    insert into xtest values ('012345678901234567890123456789')
    ERROR at line 1:
    ORA-12899: value too large for column "SCOTT"."XTEST"."X" (actual: 30, maximum: 20)Now if our table allowed more characters our insert statement is successful. As far as our "application" goes we believe, nay, we have been told by the database, we have successfully inserted our data...
    SQL> alter table xtest modify (x varchar2(50));
    Table altered.
    SQL> insert into xtest values ('012345678901234567890123456789');
    1 row created.Now if we tried to alter our database column back to 20 characters and it didn't automatically commit the data beforehand then it would be happy to alter the column, but then when the data was committed it wouldn't fit. However the database has already told us that the data was inserted, so it can't go back on that now.
    Instead we can see that the data is committed first because the alter command returns an error telling us that the data in the table is too big, and also we cannot rollback the insert after the attempted alter statement...
    SQL> alter table xtest modify (x varchar2(20));
    alter table xtest modify (x varchar2(20))
    ERROR at line 1:
    ORA-01441: cannot decrease column length because some value is too big
    SQL> rollback;
    Rollback complete.
    SQL> select * from xtest;
    X
    012345678901234567890123456789
    SQL>Obviously, because a commit statement is for the existing session, if we had tried to alter the table column from another session we would have got
    SQL> alter table xtest modify (x varchar2(20));
    alter table xtest modify (x varchar2(20))
    ERROR at line 1:
    ORA-00054: resource busy and acquire with NOWAIT specified
    SQL>... which is basically saying that we can't alter the table because someone else is using it and they haven't committed their data yet.
    Once the other session has committed the data we get the expected error...
    ORA-01441: cannot decrease column length because some value is too bigHope that explains it

Maybe you are looking for

  • My iPod freezes when I play certain songs

    Hello, I`ve had this problem for some time now. When I try to play certain songs on my (G1) iPod, it just freezes, and I have to reset it to make it work again. The strange thing is that this problem only occures with some of the songs, not all, and

  • Does Verizon Wireless really care about its customers?

    I tried to purchase online the free Ellipsis tablet on Black Friday with the 2 year agreement.  The website directed me through the process and then told me I had to change my current plan.  I didn't want to change my plan. So I backed out of the pro

  • Slice battery for thinkpadt4​30s

    Hello, I have a thinkpad t430s with a 6 cell battery, i need to add batterylife and i find a socket that appears to be a socket for a slice battery in the bottom of my laptop however when i search for the battery on lenovo website or anywhere else i

  • AP Check Signature files

    How is the signature file controlled within XML Publisher? Is this any different that other products like Bottom Line or Optio?

  • 1231 firmware

    When trying to update from 12.3(8)JA3 to 12.3(13) JEA1 using TFTP server on 1231G AP I receive "error 123 in system call CreateFile the filename, directory name or volume label syntax is incorrect. Help..