Threaded inner classes & heap memory exhaustion

(_) how can i maximize my threading without running out of
heap memory?
push it to the limit, but throttle back before an
java.lang.OutOfMemoryError.
(_) within 1 threaded class ThreadClass, i have two threaded inner classes. for each instance of ThreadClass i only
start one instance of each inner class.
and, i start hundreds of ThreadClass, but not until the previously running ThreadClass object exits, so only one should be running at any given time.
so, what about threaded inner classes?
are they good? bad? cause "OutOfMemoryErrors"?
are those inner threads not dying?
what are common causes of:
java.lang.OutOfMemoryError: java heap space?
my program runs for about 5-minutes, then
bails with the memory error.
how can i drill down and see what
is eating-up all my memory?
thanks.

A Thread class is not the same as a thread of
execution. Those inner class based threads of
execution are not dying.maybe. but this is the way i test a thread's life:
public void run() {
System.out.println("thread start");
System.out.println("thread dies and release memory");
}for each inner thread, and the outer thread, this approach for
testing thread life reveals that they die.
Why don't you use a thread pool?ok. i will think about how to do this.
>
If not, you need to ensure those inner threads have
exited and completed.what is a 100% sure check to guarantee a thread exits other than
the one i use above?
note:
the outer thread is running on a remote host, and the inner threads
are running locally. here are the details:
public class BB implements Runnable, FinInterface {
  public void run() {
    // do some work on the remote machine
  private void startResultsHandler(OisXoos oisX) {
     ResultHandler rh = new ResultHandler(oisX);
     rh.start();
  public void startDataProxy(OisXoos oisX, String query) {
     DataProxy dp = new DataProxy(oisX, query);
     dp.start();
        public class ResultsHandler extends Thread {
           // runs locally; waits for results from servers
           public void run() {
               ObjectInputStream ois = new ObjectInputStream(oisX.input);
                Set result = (Set) ois.readObject();
        }  // ____ class :: _ ResultsHandler _ :: class ____
       public class DataProxy extends Thread {
           // runs locally; performs db queries on behalf of servers
           public void run() {
               ObjectOutputStream oos = new ObjectOutputStream(oisX.output);
                while(moreData) {
                    .... // sql queries
                    oos.writeObject(data);
             StartResultsHandler(oisX);
        } // _____ class  :: _ DataProxy _ :: class _____
}now, the BB class is not started locally.
the inner threads are started locally to both service data requests
by the BB thread as well as wait for its results.
(_) so, maybe the inner threads cannot exit (but they sure look
like they exit) until their parent BB thread exits.
(_) yet, those inner threads have no knowledge that the BB
thread is running.
externalizing those inner thread classes will put 2-weeks of work
in the dust bin. i want to keep them internal.
thanks.
here this piece of code that controls everything:
while(moreData) {
  FinObjects finObj = new BB();
  String symb = (String) data_ois.readObject();
  OisXoos oisX = RSAdmin.getServer();
  oisX.xoos.writeObject(finObj);
  finObj.startDataProxy(finObj, oisX, symb);
}

Similar Messages

  • Java Inner classes within the Threading paradigm

    Hi all.
    Im familiar with static nested classes, method local classes, inner classes and anonymous classes.
    But what I am a little perplexed by, is when exactly to use inner classes or static nested classes? (forgetting anonymous classes and method local classes).
    I read this article (http://www.javaworld.com/javaworld/javaqa/2000-03/02-qa-innerclass.html) and the first point makes for a good argument, but why nest the class? Why not define it as an external class?
    Also you typically find nested classes within the Threading paradigm, but why?
    I typically would create a top level class (non nested) that would implement the Runnable interface, override run() and then
    use this class when constructing a new Thread.
    Any clarification would be greatly received.
    Thanks and Happy Friday.

    Boeing-737 wrote:
    I read this article (http://www.javaworld.com/javaworld/javaqa/2000-03/02-qa-innerclass.html) and the first point makes for a good argument, but why nest the class? Why not define it as an external class?
    I was going to provide some reasons, but when I read the article I found they were already there. Following the DRY principle I'm going to let the article speak for itself.
    Also you typically find nested classes within the Threading paradigm, but why?No, I don't. If that's where you typically find them then you haven't had a varied experience.
    I typically would create a top level class (non nested) that would implement the Runnable interface, override run() and then
    use this class when constructing a new Thread.So carry on doing that, if it works for you.

  • Can I increase heap memory without specify any class or jar file??

    Hi,
    I tried to increase my heap memory in this way :
    java -Xms256m -Xmx256m
    but I got an error ... it's seem that I must specify a class java or a .jar file ...
    This is the error :
    Usage: java [-options] class [args...]
    (to execute a class)
    or java [-options] -jar jarfile [args...]
    (to execute a jar file)
    where options include:
    -client to select the "client" VM
    -server to select the "server" VM
    -hotspot is a synonym for the "client" VM [deprecated]
    The default VM is client.
    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
    A ; separated list of directories, JAR archives,
    and ZIP archives to search for class files.
    -D<name>=<value>
    set a system property
    -verbose[:class|gc|jni]
    enable verbose output
    -version print product version and exit
    -version:<value>
    require the specified version to run
    -showversion print product version and continue
    -jre-restrict-search | -jre-no-restrict-search
    include/exclude user private JREs in the version search
    -? -help print this help message
    -X print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
    enable assertions
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
    disable assertions
    -esa | -enablesystemassertions
    enable system assertions
    -dsa | -disablesystemassertions
    disable system assertions
    -agentlib:<libname>[=<options>]
    load native agent library <libname>, e.g. -agentlib:hprof
    see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
    load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
    load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
    show splash screen with specified image
    can I increase heap memory without specify any class or jar file??
    thx

    chiara wrote:
    Hi,
    I tried to increase my heap memory in this way :
    java -Xms256m -Xmx256m
    but I got an error ... it's seem that I must specify a class java or a .jar file ...
    This is the error :
    Usage: java [-options] class [args...]
    (to execute a class)
    or java [-options] -jar jarfile [args...]
    (to execute a jar file)
    can I increase heap memory without specify any class or jar file??The job of java.exe is to execute java bytecode.
    What is it supposed to do with your request to use 256m of memory for heap
    when you are not giving it a class or a jar to run?

  • Amount of heap memory is occupied by  a Thread

    Hy, I am using threads in my application. I know the objects that are created inside the thread are stored in the heap space and this is for all the threads, right?
    So in the heap space are stored all the objects created for the threads.
    Is there a way to know the amount of heap memory is occupied by the objects created for a single thread ?
    I know I cant limit the stack memory for a thread but this memory is for the variables and not for the objects, right?
    Thanks

    Not really. The "size" of an object is a very complicated thing to compute, as it involves not only knowing the size of primitive objects and the size of references, but also a recursive calculation involving the size of objects referred to by the original object, taking into account that the object references form a directed graph and not necessarily a tree.
    That's probably more work than you want to do for whatever prompted this requirement, so I would suggest finding some simpler proxy calculation.

  • Cause of CodeBuffer memory exhaustion?

    We have had a JASIG uPortal application running under Tomcat with JVM 1.5.0_05-b05 for over a year without any JVM crashes. But now, twice within the last 2 weeks, the JVM has crashed because it has run out of CodeBuffer space. There is a bug report on this (6487381), but the bug evaluation section says "VM Crash due to exhaustion of CodeBuffer space, need to provide a softer landing." This tells me that even if the bug is fixed, there will still be an error of some kind.
    What is bothering me is that I can see no reason for the CodeBuffer memory exhaustion in the hs_err_pid15701.log file. How can I find out what caused the memory exhaustion? Both of the crashes occurred during periods of light applicaiton load, and the GC stats seem to indicate that there is plenty of memory available.
    Any help would be greatly appreciated. The hs_err_pid15701.log output is below. Thanks!
    # An unexpected error has been detected by HotSpot Virtual Machine:
    # Internal Error (434F44452255464645520E4350500060 01), pid=15701, tid=15
    # Java VM: Java HotSpot(TM) Server VM (1.5.0_05-b05 mixed mode)
    --------------- T H R E A D ---------------
    Current thread (0x00341318): JavaThread "CompilerThread1" daemon [_thread_in_native, id=15]
    Stack: [0x33b02000,0x33b81d70), sp=0x33b7fde0, free space=503k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    V [libjvm.so+0x6d2704]
    V [libjvm.so+0x42b80c]
    V [libjvm.so+0x1b1de0]
    V [libjvm.so+0x218688]
    V [libjvm.so+0x224330]
    V [libjvm.so+0x221abc]
    V [libjvm.so+0x217950]
    V [libjvm.so+0x27fd24]
    V [libjvm.so+0x275c1c]
    V [libjvm.so+0x2768d8]
    V [libjvm.so+0x332140]
    V [libjvm.so+0x2da83c]
    V [libjvm.so+0x652d58]
    Current CompileTask:
    opto:9407 ! org.jasig.portal.UserInstance.renderState(Ljavax/servlet/http/HttpServletRequest;Ljav
    ax/servlet/http/HttpServletResponse;Lorg/jasig/portal/ChannelManager;Lorg/jasig/portal/i18n/LocaleMa
    nager;Lorg/jasig/portal/IUserPreferencesManager;Ljava/lang/Object;)V (2521 bytes)
    --------------- P R O C E S S ---------------
    Java Threads: ( => current thread )
    0x0135ccd8 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=266284]
    0x014cef80 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=266277]
    0x02773088 JavaThread "Thread-163071" daemon [_thread_in_native, id=266269]
    0x02796250 JavaThread "Thread-163061" daemon [_thread_in_native, id=266254]
    0x02d18ae8 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=266248]
    0x03a1b100 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=266246]
    0x01b8cb30 JavaThread "Thread-163051" daemon [_thread_in_native, id=266235]
    0x03a23768 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=266227]
    0x03a1af40 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=266226]
    0x00ac6d78 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=266190]
    0x010bc690 JavaThread "Thread-162977" daemon [_thread_in_native, id=266093]
    0x01e1e0f8 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=266064]
    0x01b8ccf0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=266035]
    0x00fe6530 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=265937]
    0x010b9070 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=265930]
    0x022073a8 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=265893]
    0x02d236f8 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=265853]
    0x0275d630 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=265809]
    0x02778240 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=265716]
    0x025ff428 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=265583]
    0x02337088 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=265549]
    0x00ac8d80 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=265548]
    0x01b88dc8 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=265185]
    0x02227808 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=265140]
    0x0097f438 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=265139]
    0x02773248 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=265057]
    0x014c5910 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=265024]
    0x01e5add8 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=265002]
    0x0249e028 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264988]
    0x012d6f98 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264914]
    0x04571230 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264887]
    0x015f81f0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264745]
    0x0158c258 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264739]
    0x00fe5508 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264694]
    0x007d4380 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264637]
    0x0222ca80 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264623]
    0x025c50d0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264606]
    0x0249de68 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264596]
    0x00f12570 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264565]
    0x02606c78 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264548]
    0x016ab908 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264481]
    0x02d1fa08 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264464]
    0x0076c200 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264463]
    0x025a6360 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264312]
    0x0249fcb0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264293]
    0x025a5b98 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264131]
    0x0146b9e8 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=264110]
    0x005c0530 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=263911]
    0x017713f0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=263605]
    0x00acb630 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=263604]
    0x03a02b58 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=263564]
    0x014c87e8 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=263563]
    0x0264cc18 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=263525]
    0x025ea728 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=263252]
    0x03a01250 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=263251]
    0x022c51c8 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=263148]
    0x03a01090 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=263131]
    0x00e8d520 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=263092]
    0x014bff18 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=263082]
    0x01591e90 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=263079]
    0x015a8aa0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=263078]
    0x02388198 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=262738]
    0x0235e598 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=262712]
    0x03a235a8 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=262540]
    0x02e7ac58 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=262393]
    0x025e70c0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=262392]
    0x03a00d10 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=262358]
    0x03a00ed0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=262268]
    0x010b3658 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=262223]
    0x025ed920 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=262197]
    0x01070268 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=262196]
    0x025e0328 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=262011]
    0x0222ffd0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=262002]
    0x0276c578 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=261965]
    0x02333d48 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=261889]
    0x01874f28 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=261841]
    0x0096a3f0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=261777]
    0x025eb758 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=261755]
    0x010b19d0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=261651]
    0x01e5f058 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=261625]
    0x0221a1f0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=261543]
    0x0062e008 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=261542]
    0x01b8c970 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=261534]
    0x01580e80 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=261435]
    0x025e6f00 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=261359]
    0x00fe92b8 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=261285]
    0x025cd6d8 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=261264]
    0x007912f0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=261236]
    0x027590c8 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=261102]
    0x02748138 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=259036]
    0x023373c8 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=258276]
    0x00983b50 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=258096]
    0x01e780d0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=258019]
    0x02192890 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=257928]
    0x002e42a0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=257881]
    0x009e23a0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=257856]
    0x025f26c0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=257708]
    0x02b29128 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=257172]
    0x022b5890 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=255735]
    0x01baddf8 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=255151]
    0x022058f8 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=255049]
    0x02d47640 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=254806]
    0x015d0448 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=253812]
    0x025adeb0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=252183]
    0x00ed9080 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=250280]
    0x00e87c58 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=249544]
    0x005ee2a0 JavaThread "JavaMail-EventQueue" daemon [_thread_blocked, id=243050]
    0x00510940 JavaThread "TP-Processor160" daemon [_thread_in_native, id=169567]
    0x00fcbc48 JavaThread "TP-Processor159" daemon [_thread_blocked, id=169566]
    0x01111668 JavaThread "TP-Processor158" daemon [_thread_blocked, id=169565]
    0x0212e6e8 JavaThread "TP-Processor157" daemon [_thread_blocked, id=169564]
    0x0182ae50 JavaThread "TP-Processor156" daemon [_thread_in_native, id=169558]
    0x013c4960 JavaThread "TP-Processor155" daemon [_thread_blocked, id=169557]
    0x02359fc8 JavaThread "TP-Processor154" daemon [_thread_blocked, id=169556]
    0x010b3498 JavaThread "TP-Processor153" daemon [_thread_in_native, id=169555]
    0x00d54918 JavaThread "TP-Processor152" daemon [_thread_blocked, id=169553]
    0x01a07020 JavaThread "TP-Processor151" daemon [_thread_in_native, id=169552]
    0x012565e8 JavaThread "TP-Processor149" daemon [_thread_blocked, id=169550]
    0x00d02d40 JavaThread "TP-Processor148" daemon [_thread_blocked, id=169544]
    0x023dab68 JavaThread "TP-Processor146" daemon [_thread_blocked, id=169542]
    0x006b0cd8 JavaThread "TP-Processor144" daemon [_thread_in_native, id=169538]
    0x012dd0e8 JavaThread "TP-Processor143" daemon [_thread_blocked, id=169537]
    0x00774cd8 JavaThread "TP-Processor142" daemon [_thread_blocked, id=169536]
    0x02122d78 JavaThread "TP-Processor141" daemon [_thread_blocked, id=169535]
    0x01ea2140 JavaThread "TP-Processor133" daemon [_thread_blocked, id=168754]
    0x00801200 JavaThread "TP-Processor132" daemon [_thread_in_native, id=168751]
    0x017b88b0 JavaThread "TP-Processor126" daemon [_thread_in_native, id=168722]
    0x008a8aa8 JavaThread "TP-Processor125" daemon [_thread_in_native, id=168721]
    0x011f6bf0 JavaThread "TP-Processor123" daemon [_thread_blocked, id=168703]
    0x00d62440 JavaThread "TP-Processor121" daemon [_thread_blocked, id=168701]
    0x005423a8 JavaThread "TP-Processor120" daemon [_thread_in_native, id=168511]
    0x005f4868 JavaThread "TP-Processor119" daemon [_thread_in_native, id=168510]
    0x00fb2308 JavaThread "TP-Processor116" daemon [_thread_blocked, id=168494]
    0x00780b38 JavaThread "TP-Processor112" daemon [_thread_blocked, id=168471]
    0x018e6d50 JavaThread "TP-Processor111" daemon [_thread_blocked, id=168470]
    0x01867210 JavaThread "TP-Processor109" daemon [_thread_blocked, id=168468]
    0x024367c0 JavaThread "TP-Processor104" daemon [_thread_blocked, id=167922]
    0x019d6b68 JavaThread "TP-Processor103" daemon [_thread_in_native, id=167921]
    0x0229f620 JavaThread "TP-Processor100" daemon [_thread_in_native, id=167917]
    0x012b2d78 JavaThread "TP-Processor95" daemon [_thread_in_native, id=167912]
    0x01071a20 JavaThread "TP-Processor91" daemon [_thread_blocked, id=167908]
    0x0299bbe8 JavaThread "TP-Processor86" daemon [_thread_in_native, id=167903]
    0x00c77a38 JavaThread "TP-Processor85" daemon [_thread_blocked, id=167902]
    0x01910c58 JavaThread "TP-Processor84" daemon [_thread_in_native, id=167901]
    0x024b6318 JavaThread "TP-Processor83" daemon [_thread_in_native, id=167900]
    0x00e76850 JavaThread "TP-Processor72" daemon [_thread_blocked, id=167889]
    0x008771d0 JavaThread "TP-Processor70" daemon [_thread_in_native, id=167887]
    0x006b7bf0 JavaThread "TP-Processor68" daemon [_thread_in_native, id=167861]
    0x027edd10 JavaThread "TP-Processor59" daemon [_thread_blocked, id=167842]
    0x018b0b98 JavaThread "TP-Processor58" daemon [_thread_blocked, id=167841]
    0x00ef4690 JavaThread "TP-Processor57" daemon [_thread_blocked, id=167840]
    0x017b9078 JavaThread "TP-Processor55" daemon [_thread_blocked, id=167628]
    0x00878e58 JavaThread "TP-Processor53" daemon [_thread_blocked, id=167626]
    0x007a6950 JavaThread "TP-Processor46" daemon [_thread_in_native, id=160765]
    0x010d30a0 JavaThread "TP-Processor41" daemon [_thread_blocked, id=160748]
    0x00cdd850 JavaThread "TP-Processor37" daemon [_thread_in_native, id=160723]
    0x004061f0 JavaThread "TP-Processor34" daemon [_thread_blocked, id=160687]
    0x0116e0e8 JavaThread "Thread-88672" daemon [_thread_blocked, id=143122]
    0x0128a780 JavaThread "Thread-88671" daemon [_thread_blocked, id=143121]
    0x01b6c758 JavaThread "Thread-88670" daemon [_thread_blocked, id=143120]
    0x01749d70 JavaThread "Thread-88669" daemon [_thread_blocked, id=143119]
    0x00e23440 JavaThread "Thread-88667" daemon [_thread_blocked, id=143116]
    0x019ec860 JavaThread "Thread-88666" daemon [_thread_blocked, id=143115]
    0x00e49e20 JavaThread "Thread-88665" daemon [_thread_blocked, id=143114]
    0x01239b98 JavaThread "Thread-88663" daemon [_thread_blocked, id=143109]
    0x0076d678 JavaThread "Thread-88662" daemon [_thread_blocked, id=143108]
    0x00b3b278 JavaThread "Thread-88661" daemon [_thread_blocked, id=143107]
    0x00b920c8 JavaThread "Thread-88660" daemon [_thread_blocked, id=143106]
    0x00759e18 JavaThread "Thread-88659" daemon [_thread_blocked, id=143105]
    0x0234a640 JavaThread "Thread-88658" daemon [_thread_blocked, id=143104]
    0x013411f0 JavaThread "Thread-88657" daemon [_thread_blocked, id=143103]
    0x00606778 JavaThread "Thread-88656" daemon [_thread_blocked, id=143102]
    0x0114f470 JavaThread "Thread-88655" daemon [_thread_blocked, id=143101]
    0x0040b588 JavaThread "Thread-88654" daemon [_thread_blocked, id=143100]
    0x01aefbf0 JavaThread "Thread-88653" daemon [_thread_blocked, id=143099]
    0x02439270 JavaThread "Thread-88652" daemon [_thread_blocked, id=143098]
    0x005fec38 JavaThread "Thread-88651" daemon [_thread_blocked, id=143097]
    0x01965138 JavaThread "TP-Processor32" daemon [_thread_in_native, id=65561]
    0x014196e0 JavaThread "TP-Processor31" daemon [_thread_blocked, id=65560]
    0x013d7dc8 JavaThread "TP-Processor29" daemon [_thread_blocked, id=65558]
    0x007031e8 JavaThread "Timer-0" daemon [_thread_blocked, id=581]
    0x005ecc90 JavaThread "TP-Processor26" daemon [_thread_in_native, id=267]
    0x005ecad0 JavaThread "TP-Processor25" daemon [_thread_blocked, id=266]
    0x02446190 JavaThread "TP-Processor17" daemon [_thread_blocked, id=121]
    0x01130a60 JavaThread "TP-Processor14" daemon [_thread_in_native, id=99]
    0x004fd2e8 JavaThread "Thread-47" daemon [_thread_blocked, id=89]
    0x00c2a418 JavaThread "Thread-46" daemon [_thread_blocked, id=88]
    0x01b489c0 JavaThread "Thread-45" daemon [_thread_blocked, id=87]
    0x01acf2e0 JavaThread "TP-Processor10" daemon [_thread_in_native, id=80]
    0x00897a18 JavaThread "Thread-39" daemon [_thread_blocked, id=76]
    0x009006c0 JavaThread "Thread-38" daemon [_thread_blocked, id=75]
    0x008ffc60 JavaThread "Thread-37" daemon [_thread_blocked, id=74]
    0x027b8f00 JavaThread "Thread-36" daemon [_thread_blocked, id=73]
    0x003f8ce8 JavaThread "Thread-35" daemon [_thread_blocked, id=72]
    0x01338c40 JavaThread "Thread-33" daemon [_thread_blocked, id=70]
    0x02594ad8 JavaThread "Thread-32" daemon [_thread_blocked, id=69]
    0x00d08950 JavaThread "Thread-31" daemon [_thread_blocked, id=68]
    0x0185fb98 JavaThread "Thread-30" daemon [_thread_blocked, id=67]
    0x00771160 JavaThread "Thread-28" daemon [_thread_blocked, id=52]
    0x00cc65b0 JavaThread "Thread-27" daemon [_thread_blocked, id=51]
    0x009d50c0 JavaThread "Thread-26" daemon [_thread_blocked, id=50]
    0x00ab6318 JavaThread "Thread-25" daemon [_thread_blocked, id=49]
    0x009edab8 JavaThread "Thread-24" daemon [_thread_blocked, id=48]
    0x00a990d0 JavaThread "Thread-23" daemon [_thread_blocked, id=47]
    0x01b4d918 JavaThread "Thread-18" daemon [_thread_blocked, id=40]
    0x003a00a0 JavaThread "Thread-16" daemon [_thread_blocked, id=37]
    0x017f22c0 JavaThread "Thread-15" daemon [_thread_blocked, id=36]
    0x01ac6660 JavaThread "Thread-14" daemon [_thread_blocked, id=35]
    0x01ac6440 JavaThread "Thread-13" daemon [_thread_blocked, id=34]
    0x003b9c08 JavaThread "Thread-12" daemon [_thread_blocked, id=33]
    0x01176860 JavaThread "uPortal ReferenceEntityCache sweeper thread #4" daemon [_thread_blocked, id
    =31]
    0x01a36580 JavaThread "uPortal ReferenceEntityCache sweeper thread #3" daemon [_thread_blocked, id
    =30]
    0x010467e8 JavaThread "uPortal ReferenceEntityCache sweeper thread #2" daemon [_thread_blocked, id
    =29]
    0x01421aa0 JavaThread "Thread-10" daemon [_thread_blocked, id=28]
    0x009b3240 JavaThread "uPortal ReferenceEntityCache sweeper thread #1" daemon [_thread_blocked, id
    =27]
    0x00da46f0 JavaThread "TP-Monitor" daemon [_thread_blocked, id=26]
    0x01986f60 JavaThread "TP-Processor4" daemon [_thread_in_native, id=25]
    0x011f0808 JavaThread "TP-Processor3" daemon [_thread_blocked, id=24]
    0x011f0648 JavaThread "TP-Processor2" daemon [_thread_blocked, id=23]
    0x014ec510 JavaThread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" daemon [_thread_blo
    cked, id=21]
    0x011ef460 JavaThread "Whirlycache Tuner ( userInfoCache )" daemon [_thread_blocked, id=20]
    0x0236d6c8 JavaThread "Whirlycache Tuner ( principalCache )" daemon [_thread_blocked, id=19]
    0x02598310 JavaThread "Whirlycache Tuner ( default )" daemon [_thread_blocked, id=18]
    0x00342490 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=16]
    =>0x00341318 JavaThread "CompilerThread1" daemon [_thread_in_native, id=15]
    0x003403e0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=14]
    0x0033f4a8 JavaThread "AdapterThread" daemon [_thread_blocked, id=13]
    0x003383a0 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=12]
    0x0032b860 JavaThread "YJPAgent-CPUSampler" daemon [_thread_blocked, id=11]
    0x00323220 JavaThread "YJPAgent-RequestListener" daemon [_thread_in_native, id=10]
    0x00331d20 JavaThread "YJPAgent-Telemetry" daemon [_thread_blocked, id=9]
    0x00312880 JavaThread "Finalizer" daemon [_thread_blocked, id=8]
    0x001bf9b0 JavaThread "Reference Handler" daemon [_thread_blocked, id=7]
    0x001fe030 JavaThread "main" [_thread_in_native, id=1]
    Other Threads:
    0x0030af68 VMThread [id=6]
    0x00343fe8 WatcherThread [id=17]
    VM state:not at safepoint (normal execution)
    VM Mutex/Monitor currently owned by a thread: None
    Heap
    PSYoungGen total 310016K, used 250106K [0xc7c00000, 0xdbc00000, 0xf7c00000)
    eden space 292352K, 81% used [0xc7c00000,0xd634e4b8,0xd9980000)
    from space 17664K, 75% used [0xd9980000,0xda670460,0xdaac0000)
    to space 17344K, 0% used [0xdab10000,0xdab10000,0xdbc00000)
    PSOldGen total 1647808K, used 1572315K [0x37c00000, 0x9c530000, 0xc7c00000)
    object space 1647808K, 95% used [0x37c00000,0x97b76df0,0x9c530000)
    PSPermGen total 46848K, used 31224K [0x33c00000, 0x369c0000, 0x37c00000)
    object space 46848K, 66% used [0x33c00000,0x35a7e190,0x369c0000)
    0x00010000 /usr/java/bin/java
    0xff360000 /usr/lib/libthread.so.1
    0xff3a0000 /usr/lib/libdl.so.1
    0xff280000 /usr/lib/libc.so.1
    0xff350000 /usr/platform/SUNW,Sun-Fire-V240/lib/libc_psr.so.1
    0xfdc00000 /usr/jdk/instances/jdk1.5.0/jre/lib/sparc/server/libjvm.so
    0xff220000 /usr/lib/libsocket.so.1
    0xff200000 /usr/lib/libsched.so.1
    0xff1d0000 /usr/lib/libCrun.so.1
    0xff1a0000 /usr/lib/libm.so.1
    0xff080000 /usr/lib/libnsl.so.1
    0xff240000 /usr/lib/libw.so.1
    0xff160000 /usr/lib/libmp.so.2
    0xff060000 /usr/jdk/instances/jdk1.5.0/jre/lib/sparc/native_threads/libhpi.so
    0xfe680000 /nau/local/opt/yourkit/yjp-5.5.4/bin/solaris-sparc-32/libyjpagent.so
    0xfe650000 /usr/jdk/instances/jdk1.5.0/jre/lib/sparc/libverify.so
    0xfe610000 /usr/jdk/instances/jdk1.5.0/jre/lib/sparc/libjava.so
    0xfe5f0000 /usr/jdk/instances/jdk1.5.0/jre/lib/sparc/libzip.so
    0xfe4a0000 /usr/jdk/instances/jdk1.5.0/jre/lib/sparc/libnet.so
    0xfe480000 /usr/jdk/instances/jdk1.5.0/jre/lib/sparc/libmanagement.so
    0xf7c30000 /usr/lib/nss_nis.so.1
    0x33be0000 /usr/lib/nss_files.so.1
    VM Arguments:
    jvm_args: -Xms1536m -Xmx3072m -XX:+UseParallelGC -XX:NewSize=320m -XX:NewRatio=3 -verbose:gc -XX:+Pr
    intGCDetails -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintHeapAtGC -agentpath:/na
    u/local/opt/yourkit/yjp-5.5.4/bin/solaris-sparc-32/libyjpagent.so=disablealloc,disablecounts,port=10
    111,dir=/nau/local/opt/yourkit -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Dj
    ava.endorsed.dirs=/nau/local/opt/tomcat/common/endorsed -Dcatalina.base=/nau/local/opt/tomcat -Dcata
    lina.home=/nau/local/opt/tomcat -Djava.io.tmpdir=/nau/local/opt/tomcat/temp
    java_command: org.apache.catalina.startup.Bootstrap start
    Environment Variables:
    JAVA_HOME=/usr/java
    PATH=/nau/local/opt/uportal/bin:.:/nau/local/bin:/nau/share/bin:/usr/sbin:/usr/bin:/usr/ucb:/opt/bin
    :/usr/ccs/bin:/opt/RICHPse/bin:/nau/share/oracle:/nau/share/oracle/product/920/bin:/nau/share/oracle
    /product/920/OPatch:/nau/local/opt/ant/bin:/nau/local/opt/ant/bin
    LD_LIBRARY_PATH=/usr/jdk/instances/jdk1.5.0/jre/lib/sparc/server:/usr/jdk/instances/jdk1.5.0/jre/lib
    /sparc:/usr/jdk/instances/jdk1.5.0/jre/../lib/sparc
    SHELL=/bin/ksh
    HOSTTYPE=sun4
    OSTYPE=solaris
    MACHTYPE=sparc
    Signal Handlers:
    SIGSEGV: [libjvm.so+0x6d3178], sa_mask[0]=0xffbffeff, sa_flags=0x00000004
    SIGBUS: [libjvm.so+0x6d3178], sa_mask[0]=0xffbffeff, sa_flags=0x00000004
    SIGFPE: [libjvm.so+0x273260], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c
    SIGPIPE: [libjvm.so+0x273260], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c
    SIGILL: [libjvm.so+0x273260], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c
    SIGUSR1: [libjvm.so+0x655038], sa_mask[0]=0x00008000, sa_flags=0x00000008
    SIGUSR2: [libjvm.so+0x273260], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c
    SIGHUP: [libjvm.so+0x653eb8], sa_mask[0]=0xffbffeff, sa_flags=0x00000004
    SIGINT: SIG_IGN, sa_mask[0]=0x00000000, sa_flags=0x00000000
    SIGQUIT: [libjvm.so+0x653eb8], sa_mask[0]=0xffbffeff, sa_flags=0x00000004
    SIGTERM: [libjvm.so+0x653eb8], sa_mask[0]=0xffbffeff, sa_flags=0x00000004
    --------------- S Y S T E M ---------------
    OS: Solaris 8 HW 12/02 s28s_hw1wos_06a SPARC
    Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
    Assembled 12 December 2002
    uname:SunOS 5.8 Generic_108528-23 sun4u (T1 libthread)
    rlimit: STACK 8192k, CORE infinity, NOFILE 4096, AS infinity
    load average:0.08 0.03 0.03
    CPU:total 2 has_v8, has_v9, has_vis1, has_vis2, is_ultra3
    Memory: 8k page, physical 6291456k(3143232k free)
    vm_info: Java HotSpot(TM) Server VM (1.5.0_05-b05) for solaris-sparc, built on Aug 26 2005 16:11:55
    by unknown with unknown Workshop:0x550

    I suspect that you've run out of C malloc space for VM data structures for the CodeBuffer and not Java object heap memory. You could use ps to watch the virtual memory usage of the process.
    You are running the 32-bit JVM, and have -Xmx3072m reserving 3GB of the available address space for the heap. You are running 200+ threads, whose stacks also use up address space. You could try shrinking the thread stack size with the -XX:ThreadStackSize= command line option. That might cause StackOverflowError's if you need deep stacks. With tuning, one can run thousands of threads.
    At the point of the crash you were using 95% of the Java object heap (the PSOldGen), but if that isn't all live data, you could try shrinking your -Xmx a little to leave room for other VM data structures. You can tell what your live data size is by looking at the GC logs after a full collection. You want the PSOldGen to be at least that large, plus at least enough room for a young generation (being somewhat conservative), plus you need space for the young generation itself. You might have to shrink your young generation a little to make it all fit. (I haven't done the math.) Shrinking your young generation will give you more frequent, but probably shorter, young collection pauses.

  • Private inner classes

    I'm trying to complete a "turn the lightbulb on and off" program, but when I try to draw circle2 in the
    ButtonListener class I get an error message cannot find symbol. This is in reference to the Graphics
    variable "page" created in the paintComponent method below. Shouldn't the inner class, private or
    public inherit all data variables including objects from the parent class, in this case, the Bulb class? The code is below.
    By the way, this IS NOT a school assignment so any help would be appreciated. I'm just trying to learn
    this language.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Bulb extends JPanel
         private JButton push;
         private Circle circle, circle2;
         private final int DIAMETER = 100;
         private final int X = 10;
         private final int Y = 10;
         public Bulb()
              circle = new Circle(DIAMETER, Color.white, X,Y);
              circle2 = new Circle(DIAMETER, Color.yellow, X, Y); // to separate class
              push = new JButton("Turn on the Bulb");
              push.addActionListener(new ButtonListener());
              add(push);
              setPreferredSize(new Dimension(500, 500));
              setBackground(Color.black);
         public void paintComponent(Graphics page)
              super.paintComponent(page);
              circle.draw(page);
    private class ButtonListener implements ActionListener
              public void actionPerformed(ActionEvent event) //PROBLEM AREA. I GET ERROR MESSAGE STATING
    // "CANNOT FIND SYMBOL" IN REFERENCE TO VARIABLE "PAGE."
    // I THOUGHT THE INNER CLASS INHERITS ALL DATA FROM
    // PARENT CLASS SUCH AS "PAGE."
                   circle2.draw(page);
    }

    There are fields, which are associated with either a class or an object (and thus live in the heap in an object on the heap), and there are local variables, which are associated with methods and threads (i.e., a method invoked within a thread, and which thus live on the stack).
    They're not the same thing.
    You can't use a local variable in your paintComponent method in a different method.
    Anyway you're designing your class wrong. Think model-view-controller. You have the model: a bunch of state and possibly behavior that represents the thing being seen, modified, and displayed. You have the view, which is how you see the model. And you have the controller, which modifies the model.
    Your event handlers are part of the controller. They should change the model.
    Your paintComponent method is part of the view.
    So the event handlers should change some data, e.g., add a note that a circle should be displayed.
    Then your paintComponent method should look at the data and act accordingly -- e.g., see that there's a circle to be displayed, and display it.

  • Can off JVM heap Memory used in the Near-Cache front-tier

    I had tried to config a near-Cache used nio-manager(off JVM heap) in the Front-tier.
    <near-scheme>
          <scheme-name>CohApp-near</scheme-name>
          <front-scheme>
            <external-scheme>
            </external-scheme>
          </front-scheme>
          <back-scheme>
            <distributed-scheme>
              <scheme-ref>CohApp-distributed</scheme-ref>
            </distributed-scheme>
          </back-scheme>
          <invalidation-strategy>auto</invalidation-strategy>
          <autostart>true</autostart>
        </near-scheme>
    when start 'com.tangosol.net.DefaultCacheServer' for this config, error as:
    Oracle Coherence Version 3.7.1.0 Build 27797
    Enterprise Edition: Development mode
    Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
    2014-03-30 16:34:17.518/1.201 Oracle Coherence EE 3.7.1.0 <Error> (thread=main,
    member=n/a): Error org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invali
    d content was found starting with element 'external-scheme'. One of '{"http://xm
    lns.oracle.com/coherence/coherence-cache-config":local-scheme, "http://xmlns.ora
    cle.com/coherence/coherence-cache-config":class-scheme}' is expected. - line 92
    Exception in thread "main" (Wrapped: Failed to load the factory) (Wrapped: Missi
    ng or inaccessible constructor "com.tangosol.net.DefaultConfigurableCacheFactory
    (String)"
    <configurable-cache-factory-config>
      <class-name>com.tangosol.net.DefaultConfigurableCacheFactory</class-name>
      <init-params>
        <init-param>
          <param-type>java.lang.String</param-type>
          <param-value>coherence-cache-config.xml</param-value>
        </init-param>
      </init-params>
    </configurable-cache-factory-config>) java.lang.reflect.InvocationTargetExceptio
    n
            at com.tangosol.util.Base.ensureRuntimeException(Base.java:288)
            at com.tangosol.net.ScopedCacheFactoryBuilder.getDefaultFactory(ScopedCa
    cheFactoryBuilder.java:311)
            at com.tangosol.net.DefaultCacheFactoryBuilder.getSingletonFactory(Defau
    ltCacheFactoryBuilder.java:48)
            at com.tangosol.net.DefaultCacheFactoryBuilder.getFactory(DefaultCacheFa
    ctoryBuilder.java:121)
            at com.tangosol.net.ScopedCacheFactoryBuilder.getConfigurableCacheFactor
    y(ScopedCacheFactoryBuilder.java:112)
            at com.tangosol.net.CacheFactory.getConfigurableCacheFactory(CacheFactor
    y.java:126)
            at com.tangosol.net.DefaultCacheServer.getDefaultConfigurableCacheFactor
    y(DefaultCacheServer.java:364)
            at com.tangosol.net.DefaultCacheServer.main(DefaultCacheServer.java:197)
    Caused by: (Wrapped: Missing or inaccessible constructor "com.tangosol.net.Defau
    ltConfigurableCacheFactory(String)"
    <configurable-cache-factory-config>
      <class-name>com.tangosol.net.DefaultConfigurableCacheFactory</class-name>
      <init-params>
        <init-param>
          <param-type>java.lang.String</param-type>
          <param-value>coherence-cache-config.xml</param-value>
        </init-param>
      </init-params>
    </configurable-cache-factory-config>) java.lang.reflect.InvocationTargetExceptio
    n
            at com.tangosol.util.Base.ensureRuntimeException(Base.java:288)
            at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2652)
            at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2536)
            at com.tangosol.net.ScopedCacheFactoryBuilder.getDefaultFactory(ScopedCa
    cheFactoryBuilder.java:273)
            ... 6 more
    Caused by: java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
    orAccessorImpl.java:39)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
    onstructorAccessorImpl.java:27)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
            at com.tangosol.util.ClassHelper.newInstance(ClassHelper.java:694)
            at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2611)
            ... 8 more
    Caused by: (Wrapped: Failed to load cache configuration: coherence-cache-config.
    xml) (Wrapped) java.io.IOException: Exception occurred during schema validation:
    cvc-complex-type.2.4.a: Invalid content was found starting with element 'externa
    l-scheme'. One of '{"http://xmlns.oracle.com/coherence/coherence-cache-config":l
    ocal-scheme, "http://xmlns.oracle.com/coherence/coherence-cache-config":class-sc
    heme}' is expected.
            at com.tangosol.util.Base.ensureRuntimeException(Base.java:288)
            at com.tangosol.run.xml.XmlHelper.loadResourceInternal(XmlHelper.java:34
    1)
            at com.tangosol.run.xml.XmlHelper.loadFileOrResource(XmlHelper.java:283)
            at com.tangosol.net.DefaultConfigurableCacheFactory.loadConfig(DefaultCo
    nfigurableCacheFactory.java:439)
            at com.tangosol.net.DefaultConfigurableCacheFactory.loadConfig(DefaultCo
    nfigurableCacheFactory.java:425)
            at com.tangosol.net.DefaultConfigurableCacheFactory.<init>(DefaultConfig
    urableCacheFactory.java:155)
            ... 14 more
    Caused by: (Wrapped) java.io.IOException: Exception occurred during schema valid
    ation:
    cvc-complex-type.2.4.a: Invalid content was found starting with element 'externa
    l-scheme'. One of '{"http://xmlns.oracle.com/coherence/coherence-cache-config":l
    ocal-scheme, "http://xmlns.oracle.com/coherence/coherence-cache-config":class-sc
    heme}' is expected.
            at com.tangosol.run.xml.XmlHelper.loadXml(XmlHelper.java:122)
            at com.tangosol.run.xml.XmlHelper.loadXml(XmlHelper.java:157)
            at com.tangosol.run.xml.XmlHelper.loadResourceInternal(XmlHelper.java:32
    2)
            ... 18 more
    Caused by: java.io.IOException: Exception occurred during schema validation:
    cvc-complex-type.2.4.a: Invalid content was found starting with element 'externa
    l-scheme'. One of '{"http://xmlns.oracle.com/coherence/coherence-cache-config":l
    ocal-scheme, "http://xmlns.oracle.com/coherence/coherence-cache-config":class-sc
    heme}' is expected.
            at com.tangosol.run.xml.SimpleParser.parseXml(SimpleParser.java:212)
            at com.tangosol.run.xml.SimpleParser.parseXml(SimpleParser.java:93)
            at com.tangosol.run.xml.SimpleParser.parseXml(SimpleParser.java:162)
            at com.tangosol.run.xml.SimpleParser.parseXml(SimpleParser.java:115)
            at com.tangosol.run.xml.XmlHelper.loadXml(XmlHelper.java:118)
            ... 20 more
    Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid conten
    t was found starting with element 'external-scheme'. One of '{"http://xmlns.orac
    le.com/coherence/coherence-cache-config":local-scheme, "http://xmlns.oracle.com/
    coherence/coherence-cache-config":class-scheme}' is expected.
            at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAX
    ParseException(ErrorHandlerWrapper.java:195)
            at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Err
    orHandlerWrapper.java:131)
            at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(
    XMLErrorReporter.java:384)
            at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(
    XMLErrorReporter.java:318)
            at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErro
    rReporter.reportError(XMLSchemaValidator.java:417)
            at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportS
    chemaError(XMLSchemaValidator.java:3182)
            at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleS
    tartElement(XMLSchemaValidator.java:1806)
            at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startEl
    ement(XMLSchemaValidator.java:705)
            at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scan
    StartElement(XMLNSDocumentScannerImpl.java:400)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
    l$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2756)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(X
    MLDocumentScannerImpl.java:648)
            at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next
    (XMLNSDocumentScannerImpl.java:140)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
    l.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
            at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
    ML11Configuration.java:808)
            at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
    ML11Configuration.java:737)
            at com.sun.org.apache.xerces.internal.jaxp.validation.StreamValidatorHel
    per.validate(StreamValidatorHelper.java:144)
            at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.vali
    date(ValidatorImpl.java:111)
            at javax.xml.validation.Validator.validate(Validator.java:127)
            at com.tangosol.run.xml.SaxParser.validateXsd(SaxParser.java:236)
            at com.tangosol.run.xml.SimpleParser.parseXml(SimpleParser.java:206)
    So I think that if can off JVM heap Memory used in the Near-Cache front-tier?
    Or can help how to config the  off JVM heap Memory used in the Near-Cache front-tier.
    Thanks.

    Only local-scheme and class-scheme can be used in the front-scheme of a near cache. 

  • Inaccessible with local variable(non-final) via method local inner class

    Hi All,
    Usually local variables, including automatic final variable live on the stack and objects & instanace variables live on the heap.The contracts for using the method local inner class should allow merely method final variable, not non-final stack variable.
    Can anyone please clarify me ,behind the scene what is actual fact why method inner class should not access the stack(method) variable and only allow final variable?
    Is anything correlated with the stack and heap aspects?
    Thanks,
    Stalin.G

    [email protected] wrote:
    ...behind the scene what is actual fact why method inner class should not access the stack(method) variable and only allow final variable?...explained by dcminter and Jardium in [an older thread|http://forums.sun.com/thread.jspa?messageID=10694240#10694240|http://forums.sun.com/thread.jspa?messageID=10694240#10694240]:
    ...Final variables are copied into inner classes - that's why they have to be declared final; to avoid the developer making an incorrect assumption that the local variable can be modified and have the change reflected in the copy.
    When a local class uses a local variable, it doesn't actually use the variable. Instead, it takes a copy of the value which is contained in the variable at the moment the class is instantiated. It's like passing the variable to a constructor of the class, except that you do not actually declare any such constructor in your code.
    To avoid messy execution flows to be present in a Java method, the Java language authors thought it was better to allow a single value to be present in such a variable throughout all its life. Thus, the variable has to be declared final.
    ...HTH

  • Problem with final variables and inner classes

    variables accessed by inner classes need to be final. Else it gives compilation error. Such clases work finw from prompt. But when I try to run such classes through webstart it gives me error/exception for those final variables being accessed from inner class.
    Is there any solution to this?
    Exception is:
    java.lang.ClassFormatError: com/icorbroker/fx/client/screens/batchorder/BatchOrderFrame$2 (Illegal Variable name " val$l_table")
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
         at com.sun.jnlp.JNLPClassLoader.defineClass(Unknown Source)
         at com.sun.jnlp.JNLPClassLoader.access$1(Unknown Source)
         at com.sun.jnlp.JNLPClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
         at com.icorbroker.fx.client.screens.batchorder.BatchOrderFrame.<init>(BatchOrderFrame.java:217)
         at com.icorbroker.fx.client.screens.batchorder.BatchOrderViewController.createView(BatchOrderViewController.java:150)
         at com.icorbroker.fx.client.screens.RealTimeViewController.initialize(RealTimeViewController.java:23)
         at com.icorbroker.fx.client.screens.batchorder.BatchOrderViewController.<init>(BatchOrderViewController.java:62)
         at com.icorbroker.fx.client.screens.displayelements.DisplayPanel$3.mousePressed(DisplayPanel.java:267)
         at java.awt.Component.processMouseEvent(Component.java:5131)
         at java.awt.Component.processEvent(Component.java:4931)
         at java.awt.Container.processEvent(Container.java:1566)
         at java.awt.Component.dispatchEventImpl(Component.java:3639)
         at java.awt.Container.dispatchEventImpl(Container.java:1623)
         at java.awt.Component.dispatchEvent(Component.java:3480)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3162)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
         at java.awt.Container.dispatchEventImpl(Container.java:1609)
         at java.awt.Window.dispatchEventImpl(Window.java:1590)
         at java.awt.Component.dispatchEvent(Component.java:3480)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)

    I've also been having the same problem. The only work-around seems to be to slightly change the code, recompile & hope it works. See http://forum.java.sun.com/thread.jsp?forum=38&thread=372291

  • Problem with constructor of inner class.

    Hi everybody!
    I have an applet which loads images from a database.
    i want to draw the images in a textarea, so i wrote an inner class, which extends textarea and overrides the paint method.
    but everytime i try to disply the applet in the browser this happens:
    java.lang.NoClassDefFoundError: WohnungSuchenApplet$Malfl�che
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:1590)
    at java.lang.Class.getConstructor0(Class.java:1762)
    at java.lang.Class.newInstance0(Class.java:276)
    at java.lang.Class.newInstance(Class.java:259)
    at sun.applet.AppletPanel.createApplet(AppletPanel.java:567)
    at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1778)
    at sun.applet.AppletPanel.runLoader(AppletPanel.java:496)
    at sun.applet.AppletPanel.run(AppletPanel.java:293)
    at java.lang.Thread.run(Thread.java:536)
    so my class has no own constructor, it just has the paint method overwritten.
    my class looks like this:
    public class Malfl�che extends javax.swing.JTextArea{
    public void paint(Graphics g){
    Color grey=new Color(220,220,220);
    g.drawImage(img,10,10,null);
    how should a constructor for this class look like?
    sorry i am quite new to this, so i really dont have a clue!
    my class does not have any attributes or requires any so it doesnt need a constructor, doesnt it?
    thanks a lot
    tim

    First off, unlike regular classes, inner classes can be declared public, private, protected, and default.
    Secondly, why are you using the JTextArea to display an image, why not use a JLabel, which takes an Image object as its constructor.
    Thirdly, when you drew your image you did not give it a width and height
    g.drawImage(img, 0,0, img.getWidth(null), img.getHeight(null), null);
    otherwise it will make your image 1 X 1 pixels. not big enough to see.

  • How to pass a variable value to an inner class?

    Hi there,
    Please have a look of the code below. It's a bit long, but my concern is I did have to declare the int "i" variable as static because it is used by an inner class (if "i" is not declare as static, the code cannot be compiled).
    Is there a more "clean" way to do the way work without declaring the "i" int as static? (because the scope of this variable is not the whole program).
    Thanks for your help.
    Denis
    import java.util.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Tools{
         static int i;
         static void longTask(){
              for (Tools.i=0; Tools.i<=100; Tools.i++) {
                   SwingUtilities.invokeLater( new Runnable(){
                        public void run(){
                             myApp.jpb.setValue(Tools.i);//--- static variable i
                   for (int j=0; j<200; j++)
                        System.out.println(Tools.i+" - "+j);
    class myListener implements ActionListener{
         public void actionPerformed(ActionEvent e){
              Thread t = new Thread() {
                   public void run(){
                        Tools.longTask();
              t.start();
    public class myApp {
         static JProgressBar jpb;
         public static void main(String[] args) {
              JFrame frame = new JFrame();
              JPanel panel = new JPanel(new FlowLayout());
              jpb = new JProgressBar();
              jpb.setValue(0);
              jpb.setStringPainted(true);
              JButton button = new JButton("go");
              button.addActionListener(new myListener());
              panel.add(jpb);
              panel.add(button);
              frame.getContentPane().add( panel, BorderLayout.CENTER);
              frame.setVisible(true);
              frame.pack();
    }

    Without compiling it, writing it in notepad, it would be something like this. You should also wonder if this longTask has to be static by the way. But I think this demonstrates the inner class stuff. You can also look in the tutorial on this site: http://java.sun.com/docs/books/tutorial/essential/threads/timer.html
    class Tools{
         static int i;
         static void longTask(){
              for (Tools.i=0; Tools.i<=100; Tools.i++) {
                   SwingUtilities.invokeLater( new Innerclass(i));
                   for (int j=0; j<200; j++) {
                        System.out.println(Tools.i+" - "+j);
         Class Innerclass implements Runnable(){
              int i;
              public Innerclass(int i) {
                   this.i = i;
              public void run(){
                   myApp.jpb.setValue(Tools.i);//--- static variable i
    }

  • Trying to use super class's methods from an anonymous inner class

    Hi all,
    I have one class with some methods, and a second class which inherits from the first. The second class contains a method which starts up a thread, which is an anonymous inner class. Inside this inner class, I want to call a method from my first class. How can I do this?
    If I just call the method, it will use the second class's version of the method. However, if I use "super," it will try to find that method in the Thread class (it's own super class) and complain.
    Any suggestions?
    Code:
    public class TopClass
         public void doSomething(){
              // do something
    =============================
    public class LowerClass extends TopClass
         // overrides TopClass's doSomething.
         public void doSomething(){
              // do something
         public void testThread(){
              Thread t = new Thread(){
                   public void run(){
                        doSomething();               //fine
                        super.doSomething();          //WRONG: searches class Thread for doSomething...
              t.start();
    }

    Classes frequently call the un-overridden versions of methods from their superclasses. That's that the super keyword is for, if I'm not mistaken.You're not mistaken about the keyword, but you're not calling the superclass method from a subclass. Your anonymous inner class is not a subtype of TopLevel. It's a subtype of Thread.
    Here it is no different, except that I happen to be in a thread at the time.It's vastly different, since you're attempting to call the method from an unrelated class; i.e., Thread.
    I could also be in a button's action listener, for example. It seems natural to me that if I can do it in a method, I should be able to do it within an anonymous inner class which is inside a method.If you were in an button's action listener and needed to call a superclass' implementation of a method overridden in the button, I'd have the same questions about your design. It seems smelly to me.
    ~

  • How  to include the inner classes in a jar file in netbeans ide

    Dear java friends
    how to say to netbeans ide that it has to include the
    inner classes in the jar file.
    (i have one single applet class
    with two inner classes that show up
    in the build/classes file but not in the jar).
    The applet works in the viewer but not
    in the browser (I believe because the
    xxx$yyy etc should be in the jar)
    willemjav

    First, please stop posting the same question multiple times:
    Duplicate of http://forum.java.sun.com/thread.jspa?threadID=5269782&messageID=10127496#10127496
    with an answer.
    Second, If your problem is that you can't do this in NetBeans, you need to post to somewhere that provides NetBeans support - like the NetBeans website's mailing list. These forums do not support NetBeans (or any other IDE) - they are Java language forums.

  • Java heap memory errors..

    I make a spider program, but it runs out of memory after ~200 websites.
    after that it crashes.. or becomes so slow its useless.
    The problem is in this Spider class , that cant be garbage collected (But I dont see any reason why not)
    These profilers i have seen show you that memory is allocated and cant be garbage collected , but not where ? Can anyone give suggestions what can be wrong with this class or tell how they fix memory problems?
    peter
    import java.util.*;
    import java.net.*;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLConnection;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.PrintWriter;
    import org.htmlparser.util.ParserException;
    import org.htmlparser.Node;
    import org.htmlparser.NodeFilter;
    import org.htmlparser.Parser;
    import org.htmlparser.PrototypicalNodeFactory;
    import org.htmlparser.tags.BaseHrefTag;
    import org.htmlparser.tags.FrameTag;
    import org.htmlparser.tags.TitleTag;
    import org.htmlparser.tags.HeadingTag;
    import org.htmlparser.tags.LinkTag;
    import org.htmlparser.tags.MetaTag;
    import org.htmlparser.util.EncodingChangeException;
    import org.htmlparser.util.NodeIterator;
    import org.htmlparser.util.NodeList;
    import org.htmlparser.util.ParserException;
    import org.htmlparser.beans.StringBean;
    public class Spider implements Runnable {
       private URL base;
       private int siteid;  
       private int companyid;
       private int MaxPaginas;
       protected Collection workloadPath = new ArrayList(3);
       protected Collection workloadError = new ArrayList(3);
       protected Collection workloadWaiting = new ArrayList(3);
       protected Collection workloadProcessed = new ArrayList(3);
       protected ISpiderReportable report;
       protected Done done;
       protected Parser mParser;
       String content = "";
       String meta = "";
       String titel = "";
       String kopjes = "";
       static private int count = 0;
       private int taskNumber;
      public Spider(int DBcompanyid, int DBsiteid, URL DBbase, ISpiderReportable report)
         base = DBbase;
         siteid = DBsiteid;
         companyid = DBcompanyid;
         MaxPaginas = 20;
         this.report = report;
         count++;
         taskNumber = count;
         mParser = new Parser ();
         PrototypicalNodeFactory factory = new PrototypicalNodeFactory ();
         factory.registerTag (new LocalLinkTag ());
         factory.registerTag (new LocalMetaTag ());
         factory.registerTag (new LocalFrameTag ());
         factory.registerTag (new LocalTitleTag ());
         factory.registerTag (new LocalHeadingTag ());
         mParser.setNodeFactory (factory);
      public void run()
          clear();
          report.koppelDB(siteid,companyid);
          addURL(base);
          begin();
      public Collection getWorkloadPath()
        return workloadPath;
      public Collection getWorkloadError()
        return workloadError;
      public Collection getWorkloadWaiting()
        return workloadWaiting;
      public Collection getWorkloadProcessed()
        return workloadProcessed;
      public void clear()
        getWorkloadError().clear();
        getWorkloadWaiting().clear();
        getWorkloadProcessed().clear();
        getWorkloadPath().clear();
      public void addURL(URL url)
        if ( getWorkloadWaiting().contains(url) )
          return;
        if ( getWorkloadError().contains(url) )
          return;
        if ( getWorkloadProcessed().contains(url) )
          return;
        if ( getWorkloadPath().contains(url.getPath()) )
          return;
         getWorkloadPath().add(url.getPath());
         log("PROCES: " + taskNumber + "  Adding to workload: " + url );
         getWorkloadWaiting().add(url);
         MaxPaginas--;
       protected void processURL (URL Furl) throws ParserException
              NodeList Nlist;
             getWorkloadWaiting().remove(Furl);
             getWorkloadProcessed().add(Furl);
             String url = Furl.toString();
             StringExtractor se = new StringExtractor (url);
             try
                content = se.extractStrings ();
            catch (ParserException e)
                    e.printStackTrace ();
            try
            mParser.setURL (url);
                try
                   Nlist = new NodeList ();
                    for (NodeIterator e = mParser.elements (); e.hasMoreNodes (); )
                        Nlist.add (e.nextNode ());
                catch (EncodingChangeException ece)
                    mParser.reset ();
                    Nlist = new NodeList ();
                    for (NodeIterator e = mParser.elements (); e.hasMoreNodes (); )
                        Nlist.add (e.nextNode ());
            catch (ParserException pe)
               String message;
               message = pe.getMessage ();
               if ((null != message) && (message.endsWith ("does not contain text")))
                    System.out.println("Is geen text bestand...");
                else
                    throw pe;
            report.writeDB(siteid,(String)Furl.getPath(),content, titel, meta, kopjes);
            String content = "";
            String meta = "";
            String titel = "";
            String kopjes = "";
            log("Complete: " + url);
        class LocalLinkTag extends LinkTag
            public void doSemanticAction ()
                throws
                    ParserException
                if(!isHTTPLikeLink())
                    return;
                String link = getLink();
               int index = link.indexOf('#');
                 if (index != -1)
                     link = link.substring(0, index);
                if(MaxPaginas>1)
                   handleLink(base,link);
                else
                    return;
        class LocalFrameTag extends FrameTag
            public void doSemanticAction ()
                throws
                    ParserException
                String link = getFrameLocation ();
                if(MaxPaginas>1){
                    handleLink(base,link);
       public class StringExtractor
         private String resource;
         public StringExtractor (String resource)
            this.resource = resource;
         public String extractStrings ()
            throws
               ParserException
            StringBean sb;
            sb = new StringBean ();
            sb.setLinks (false);
            sb.setURL (resource);
            return (sb.getStrings ());
        class LocalTitleTag extends TitleTag
            public void doSemanticAction ()
                throws
                    ParserException
                titel = getTitle();
        class LocalHeadingTag extends HeadingTag
           public void doSemanticAction ()
                throws
                    ParserException
                kopjes = kopjes + " " + toPlainTextString();
          class LocalMetaTag extends MetaTag
            public void doSemanticAction ()
                throws
                    ParserException
                String metaNaam = null;
                metaNaam = getMetaTagName();
                if(metaNaam!=null)
                    if(metaNaam.equals("keywords") || metaNaam.equals("description"))
                            meta = meta + " " + getMetaContent();
      public void begin()
        while ( !getWorkloadWaiting().isEmpty()) {
           Object list[] = getWorkloadWaiting().toArray();
          for ( int i=0;(i<list.length);i++ )
          try{
             processURL((URL)list);
    }catch(ParserException pe){
    System.out.println("Parser error:"+pe);
    MaxPaginas++;
    protected void handleLink(URL base,String str)
    try {
    URL url = new URL(base,str);
    if ( report.spiderFoundURL(base,url)){
    addURL(url);
    } catch ( MalformedURLException e ) {}
    public void log(String entry)
    System.out.println(entry );
    It must have something to do with the inner classes and processURL since i replaced only this code Swing parser with htmlparser.
    I dont expect anyone to exactly say this is wrong or that, but maybe some tools and suggestions how to solve would be very welcome.
    thanks

    The structure is like this:
    public class test{
      public static void main(String args[])
             test x = new test();
             x.execute();
      public void execute()
         ThreadPool pool = new ThreadPool(10);
          for (int i = 0; i < size; i++ )
              pool.assign(new Spider(DBcompanyid, DBsiteid, base,this));
         pool.complete();
    }

  • Accessing Enclosing Class Members From Inner Class Subclass

    I have the following scenario that I cannot get to work. Notice the comments in B.doWork() for the problem code. In B.doWork(), how do I access m_strA?
    * A.java
    * Created on July 5, 2002, 2:20 PM
    package Projects.InnerTrouble.Files;
    public class A {
         public abstract class InnerA {
              public abstract void doWork ();
         public String m_strA;
         /** Creates new A */
         public A ()
                   new InnerA() {
                             public void doWork ()
                                       System.out.println("A$InnerA$1's doWork() called!");
                                       m_strA = "Annonymous subclass of InnerA's doWork did this";
                        }.doWork();
         * @param args the command line arguments
         public static void main (String args[])
                   A oTemp = new A();
                   System.out.println(oTemp.m_strA);
                   B.getB(oTemp).doWork();
                   System.out.println(oTemp.m_strA);
    class B extends A.InnerA {
         public B (A a)
                   a.super();
         public void doWork ()
                   System.out.println("B's doWork() called!");
                   // How do I access m_strA within B's doWork() method?  The following is what I would expect to be the answer, but it does not compile
                   // A.this.m_strA = "B's doWork did this";
         private static A.InnerA sm_oInnerA;
         public static A.InnerA getB (A a)
                   if (sm_oInnerA == null)
                        sm_oInnerA = new B(a);
                   return (sm_oInnerA);

    The whole point is that B is not an inner class of A
    so it does not have access to A's member variables.
    Eventhough B extends an inner class of A, that does
    not make B an inner class of A. That is in the JLS,
    but not so elegantly as I have put it, hehe.
    If B were an innerclass of InnerA, then it would
    qualify to access A's member variables.OK, I think that you are finally getting through to my thick skull on this one. Let me restate and get your check-off on my understanding of the situation.
    The only classes with access to A's this reference are A and inner classes of A that are found within the definition of A. So, despite the fact that A and B are in the same package (and B should have access to A's non-private members because B and A are in the same package), and despite the fact that we would normally state that B "is a" InnerA (which is an inner class of A and would have access to a reference to the A.this reference), B is not allowed access to A.this (because B "is not really a" InnerA in the same way that the anonymous implementation of InnerA "is a" InnerA). However, nothing would prevent me from giving B access to a reference of the enclosing A as long as it was done via a method of InnerA, and as long as the implementation of that method is contained in A's implementation.
    Does this "access" rule realy make sense? Are you aware of the justification for this rule? Or is the justification stated in the JLS? I would think that the compiler ought to be able to figure this kind of thing out and allow it. It seems to me the fact that I defined B in the way that I did, and the fact that B "is a" InnerA, implies that I desired a fairly tight relationship to A. In fact, I desired the exact relationship that exists for the anonymous implementation of InnerA.
    The following is a modified version of my original example that runs as I originally wanted it to, but works around the access rules discussed on this forum thread:
    * A.java
    * Created on July 5, 2002, 2:20 PM
    package Projects.InnerTrouble.Files;
    public class A {
         public abstract class InnerA {
              public abstract void doWork ();
              /** added to allow implementors of InnerA that are not enclosed in A's class definition to have access to the enclosing class */
              public A myEnclosingInstance ()
                        return (A.this);
         public String m_strA;
         /** Creates new A */
         public A ()
                   new InnerA() {
                             public void doWork ()
                                       System.out.println("A$InnerA$1's doWork() called!");
                                       m_strA = "Annonymous subclass of InnerA's doWork did this";
                        }.doWork();
         * @param args the command line arguments
         public static void main (String args[])
                   A oTemp = new A();
                   System.out.println(oTemp.m_strA);
                   B.getB(oTemp).doWork();
                   System.out.println(oTemp.m_strA);
    class B extends A.InnerA {
         public B (A a)
                   a.super();
         public void doWork ()
                   System.out.println("B's doWork() called!");
                   // The following is what I would expect to be the answer, but it does not compile
                   // A.this.m_strA = "B's doWork did this";
                   // added myEnclosingInstance() to get functionality desired above
                   myEnclosingInstance().m_strA = "B's doWork did this";
         private static A.InnerA sm_oInnerA;
         public static A.InnerA getB (A a)
                   if (sm_oInnerA == null)
                        sm_oInnerA = new B(a);
                   return (sm_oInnerA);
    }

Maybe you are looking for

  • VL10A : Delivery item number in case of Sales BOM : Combined order delivery

    Hi, I am an ABAPer . I have set the order combination flag on two sales orders. SO1 has items as follows: 10 : Item A 11 : Item A-1 12 : Item A-2 20 : Item B SO2 has one item 10 : Item C Now I create a combined delivery out of SO1 and SO2 The resulta

  • Formula to calculate due date considering only business days (Middle East)

    I have a form which contains two fields: 'Start Date' and 'Completion Date'; the 'Completion Date' field is automatically set, it's always 3 more days than the 'Start Date' field. The problem is that these 3 days must be only business days.  - if 'St

  • Database refresh without using RMAN duplicate

    Hi All, I am planning to refresh my test instance to a PIT using RMAN backups from PROD. I would like to know the process without connecting to PROD database and without using RMAN duplicate command. Thanks.

  • 9.0.115 problems

    When trying to instal KB923789 (flash player security) I get 3 messages: 1. Gen Warn: Te version of Windows (XPpro/SP2/IE7) you have installed does not match the update you are trying to install. 2. Gen Warn Flash: The version of Macromedia Flash you

  • CS6 Dreamweaver "Not Supported on this type of mac"

    Hello All, I have a new Macbook Pro w/ retina display. I recently bought Dreamweaver CS6 to complement Photoshop and Illustrator CS6 versions. I am running OS X 10.8.1 and Dreamweaver seems to run fine as does Photoshop and Illustrator. After install