Inheritance - can a subclass inherit an instance of a variable?

Is it possible for a subclass to inherit an instance of a variable that is contained in a method in the superclass? I'm (still) having huge problem with a subclass (and potentially many other subclasses) that need to inherit an instance of a variable..
SUPERCLASS
ConnectionBean cb = new Connection();
public void joinChat() {
...add stuff to cb
cb.send( packet );
}then the subclasses need to inherit the same state of this variable 'cb' how can this be done?
Thanks :)

It reads like:
public class Connection {
    //Create new instance of ConnectionBean
    ConnectionBean cb = new ConnectionBean();   
    //Create new instance of PresenceBuilder
    PresenceBuilder pb = new PresenceBuilder();
    //Create new instance of Comms Class
    Comms cms = new Comms();
    //Create new instance of UserInfo
    UserInfo user = new UserInfo();
    public String username;
    public String server;
    public String resource;
    public Connection() {
    //Method to send initial XML stream to Jabber Server
    public void joinChat() {
        InetAddress inetaddress;
        try {
            cb.connect( inetaddress = InetAddress.getByName( user.getServer() ));
        catch( UnknownHostException unknownhostexception ) {
            Object aobj[] = {
                "Cancel", "Retry"
            int i = JOptionPane.showOptionDialog(null, "Retry Server?", server +
                ": Not Responding", -1, 2, null, aobj, aobj[1]);
            if( i == 1 ) {
                joinChat();
            System.out.println( "Cannot resolve " + server + ":" + unknownhostexception.toString ());
            return;
        catch( IOException ioexception ) {
            Object aobj1[] = {
                "Cancel", "Retry"
            int j = JOptionPane.showOptionDialog( null, "Cannot Connect to: " + server,
                "Error Message",-1, 2, null, aobj1, aobj1[1] );
            if( j == 1 ) {
                joinChat();
            System.out.println( "Cannot connect " + server);
            return;
        System.out.println( "Joined Edit Session" );
        logonUser();
    //Method to Logon user with Jabber Server
    public void logonUser() {
        InfoQueryBuilder iqb = new InfoQueryBuilder();
        InfoQuery iq;
        IQAuthBuilder iqAuthb = new IQAuthBuilder();
        iqb.setType( "set" );
        iqAuthb.setUsername( user.getUsername() );
        iqAuthb.setPassword( user.getPassword() );
        iqAuthb.setResource( user.getResource() );
        try {
            iqb.addExtension( iqAuthb.build());
        catch ( InstantiationException e ) {
            //Building failed
            System.out.println( "Fatal Error on Auth object build");
            System.out.println( e.toString ());
            System.exit(0);
        try {
            //Build the full InfoQuery packet
            iq =( InfoQuery )iqb.build();
        catch ( InstantiationException e) {
            //Building Failed
            System.out.println( "Fatal Error on IQ object build:");
            System.out.println( e.toString());
            return;
        cb.send( iq );
        //Show <show> value
        pb.setStateShow( "chat" );
        //Show presence to Jabber Server
        pb.setStatus( "available" );
        try {
            cb.send( pb.build());
            //Add PacketListeners
            cb.addPacketListener( cms );       
        catch ( InstantiationException e ) {
            System.out.println( "Fatal Error on Presence object build:" );
            System.out.println( e.toString());
            return;
    public ConnectionBean getConnectionBean() {
        return cb;
}But I still cant access the 'cb' variable in subclasses with including this in the subclass constructor:
subclassConstructor() {
   super();
   joinChat();
but this makes it work in a different way that I wanted and doesnt allow me freedom for other subclasses..

Similar Messages

  • Can there be multiple ASM instances on single node?

    Hi,
    Can there be multiple ASM instances on single node?
    This one says No : http://www.freelists.org/archives/oracle-l/02-2008/msg00317.html
    And This one says Yes : http://www.databasejournal.com/features/oracle/article.php/3571371
    Thanks in advance.
    Thanks,
    Harsha
    Edited by: user498756 on Sep 11, 2008 2:23 AM

    ...that document doesnt say you cannot have multiple ASM instances on a node. It says "...ASM, +you only need one ASM+ instance for that computer, to manage the two database instances that use ASM."
    The fact that you only need one - and I cannot think of a good reason to have more than one - does not preclude the fact that you do seem to be able to have multiple ASM instances on a single node, each looking after its own set of disks and diskgroups.
    Again - I cannot think of a good reason to do so though!
    -Bob

  • How can I correlate an Java instance number with a server id?

    I have 6 Web App Server running ABAP and the JAVA stacks. I can log into the Central Instance server and run /usr/sap/<SID>DVEBMSG00/j2ee/configtool/configtool.sh and bring up the GUI interface to "see" all the instances and their variables. I don't see an easy way to trace back the Java INSTANCE to the physical server's hostname.
    Is there a central repository to correlate a Web App Server Java instance number to the actual hostid/hostname of the target server? I realize I can log into each Web App Server and look at the /usr/sap/<SID>D00/j2ee/cluster/instance.properties and find the Instance number, but I was wondering if this information was held in the SAP Central instance or SAP Database somewhere.

    Hi Timothy,
    The instance ID used for the JAVA cluster is generated at installation time, and -amongst other things- takes into account the time it was generated. We installed two instances in parallel (on different hosts) and ended up with almost the same instance ID.
    Because this can be very confusing, we asked SAP if this was changable - in theory it is only an ID which could be changed as long as it is updated on all places the identifier is stored - but SAP indicated that that is not possible, nor supported. We ended up with a diagram of the system architecture with all the identifiers on our desk.
    Note that in the config tool - all instances are displayed with their system instance number. If you were to install a new system it might be usefull to install all instances with different instance numbers so you and distinguish more easily between them.
    Hope this helps,
    Cheers,
    Walter

  • How Can I Use Multiple Weblogic Instances in a Single OS

    Hello Everyone,
    Actually I have to install Some different applications. Few of them need weblogic 10.3.6 and others need 10.3.4. The OS am using is Oracle  Enterprise Linux 5.
    Now I am able to install 2 separate(One of 10.3.4 and 10.3.6) instances with two different users,In two different directories.
    I have installed the weblogic 10.3.6 version with a user webadmin and installed node manager with port 5556. This is working fine.
    The main problem here is :
    In the second instance (10.3.4 ) installed with a a different user and gave the port number to NodeManager as 1600 and its not getting started. Its throwing error and also after some errors in the terminal am able to see that its reverting to port number 5556 only.
    What might be the issue?
    I have to install 2 different versions of weblogic in a single Server. But am failing with NodeManager. What Can I do to have multiple weblogic instances with multiple versions in a single server ?
    Can anyone suggest a resolution for this please ?
    Thanks in advance.

    Pl do not spam these forums with multiple posts - How Can I Use Multiple Weblogic Instances in a Single OS

  • How can i create a new instance on unix

    Hi,
    How can i create a new instance(instance only) on UNIX and how can i mount my database with this new instance.

    udayjampani wrote:
    Hi,
    How can i create a new instance(instance only) on UNIX and how can i mount my database with this new instance.1) Define Instance in your way!!?
    If you simply create a pfile and startup nomount with it, then -in theory- you have an instance running ( this method is used e.g. for restoring a rman backup )
    2) You can't. Database files are bound to a certain instance. What you can do is recreate an instance with e.g. a different name, using the scripts generated by a 'alter database backup controlfile to trace;' command
    Cheers
    FJFranken

  • How can i run a new instance of API by providing seperate JVM.

    Hello,
    I have some static member and function and they conflicted while opening the new instance of API. Can i run a new instance in separate JVM so it will run independently even we have static members and functions.
    Or do we have any other procedure, without removing "static" we can run with out conflicting ?
    Thanks
    Ashish Pancholi

    YuccaS wrote:
    Once again someone thinks static is the same in a distributed application/clustered system. The OP must realise that static is only static per jvm of which there can be more than one in an environment and may not work in a cluster if pooling is used across the cluster. I am no expert on this myself but I think the solution has something to do with creating your own class loader or use JEE which may provide the OP with the flexibility they wish to have?Personally I think they've just found a new version of some API they're using, and don't want to refactor all their code to fit it. Writing web service layers and the like, even a bunch of RMI code, is going to be more painful than that.

  • How can we calculate no. of instances in a java program ?

    Hi,
    I want to know that
    How can we calculate no. of instances in a java program ?
    Actually I just want to calculate number of live instances in a program at any time...
    Thanx in Advance
    Vijay

    Been asked a few times in this forum.
    Try having a search.
    One way, in brief, is to instrument your classes so that constructors update a per-type counter, and enqueue a PhantomReference for the instance.
    When you pop from an associated ReferenceQueue, decrement the counter for the no longer reachable type.
    Once you have this, you can query instance counts per type, or globably etc.
    We maintain a model which can be remotely queried - and display results over time using JGraph. Gives a fairly non-intrusive way to spot and narrow down the cause of memory leaks in a large application.

  • Can I set up multiple instances on iPlanet on one server, one to handle clear-text traffic, and one to handle SSL traffic?

    Long story, but the iPlanet version is 4.1 SP9. We will be filtering users coming in remotely (via internet VPN or dialup) to the SSL implementation, the internal intranet users to the clear-text implementation... thanks!

    Hi,
    you can run more then one instance in iWS.
    like one for http://www.test.com:80(for TEXT) and other for https://www.test.com:6000
    (Note: you couldn't not able to use same port for different instance). I hope this may answer your question.
    Thanks,
    Daks.

  • In which folder can I find the abap instance profile?

    Hi,
    In which folder can I find the abap instance profile?
    This is the parameter that I want to change:
    "profile parameter em/address_space_MB = 250 in the instance profile"
    Greets
    Stefan

    Hi Michal,
    my actual problom is, that during the Java-Add-In-Installation an error appears. (CJS-20057)
    j2ee-engine (dvebmgs00) do not start during this installation.
    I also change the value of max. heap size and try a rebase as it is shown in note 129813.
    nothing chances.
    this error appears all the time.
    can anybody help me please?
    Thanks.
    Greets
    Stefan

  • Can we move back an instance from end to previous activity?

    Hi,
    Using Oracle BPM WL 10.3 MP2, Can we move back an instance from end to previous activity? If yes are there any ways to make this happen? I guess that instances which are aborted cannot be brought back from end activity? but not sure.
    Any ideas / suggestions?
    Thanks,
    -Sree

    If the instance was aborted due to an exception, you could have an exception handler which would allow you to handle the error, and then retry if desired...
    However, once the instance is at End, its done...
    -Kevin

  • Can I find how many instances of BPEL process is in running state ?

    Hi,
    How can I find how many instances of BPEL process is in running state ? Any code/API ? help ? Thanks

    Check the class com.oracle.bpel.client.Locator...
    u can use the method listInstances(WhereCondition wc) to get the required details
    Regards
    Albin I

  • Can we have two admin instances while performing Dynamic clustering?

    Can we have two admin instances while performing Dynamic clustering?

    Just referring you to this thread.
    https://social.technet.microsoft.com/Forums/windowsserver/en-US/91f6434f-8a4e-4e53-b185-2f3a493aa134/issue-with-office-365-integration-module?forum=winserveressentials
    Robert Pearman SBS MVP
    itauthority.co.uk |
    Title(Required)
    Facebook |
    Twitter |
    Linked in |
    Google+

  • Can we link one application instance with multiple databases ?

    We have R12.1.1 and db is 11.1.0.7 on redhat 5.3 ( 64 bit).
    Can we link one application instance ( apps / , inst / ) with multiple database ( db / ),
    is this possible ?
    if yes how ?

    >
    Can we link one application instance ( apps / , inst / ) with multiple database ( db / ),
    is this possible ?
    No. You cant link application tier with more than one database.
    Similar query already answered by Hussein in detail in the forum :Re: Multiple instances, single Apps tier Please check that for more details
    -Rk

  • Can I have multiple TFS instances use a single SSRS installation

    Can I have multiple TFS instances use a single SSRS installation?
    Thanks

    Hi Kim,
    According to your description, you have multiple TFS instances using one Reporting Services instance. Right?
    For installing TFS, to use a named instance with Team Foundation Server, you must install SQL Server by using a named instance, or move or restore Team Foundation Server data to a named instance, or create a team project collection on a named instance. Please
    refer to the link below:
    Work with SQL Server Named Instances
    Reference:
    Understanding SQL Server and SQL Server Reporting Services
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Can I create another RAC instance on the machines already have one.

    Hi:
    I already have an 2 nodes RAC(10.2) ,I want to Know can I create another RAC instance on the same machines. if not why?
    thanks.

    913926 wrote:
    I already have an 2 nodes RAC(10.2) ,I want to Know can I create another RAC instance on the same machines. if not why? Yes - you can run into brick walls too. At high speeds. But heck, is that a good idea? Why would you want to?
    Oracle RAC scales how? By adding more servers (RAC cluster nodes) to the single RAC database.
    What do you want to do? Add more databases to a single server.
    How does that make sense ito performance, scalability, redundancy, availability, management and so on?
    Also consider that a SQL-Server/mySQL database in the Oracle context is a schema. An Oracle schema can be a logical database. Fully self-contained. Fully separated from other logical databases in that physical database. A second or third or one hundredth logical database in Oracle means a second or third or one hundredth new database schema. Not instance. Not physical database.

Maybe you are looking for

  • How do I find out what itunes account an app was bought on?

    Hello, I have a few apps that I can't synch with my new phone. I have no idea what iTunes account they were bought on. Is there any way to find out without having to log on any account (maybe in the info of the file or something...?) ? Thank you!

  • BSP passing value from Form of a page to another page

    Hi experts I need you helps for some issue! I've create a bsp page with a form with an inputField and now I need to retrieve the value inserted by the user and pass it to another page. Can you explain me how I've to do? Second question is if is possi

  • In CS2, how can I save a file as PDF 9.0+?

    Hi everyone, I use Illustrator CS2 and when I save a file in CS2 (Save As) as a PDF i can only save it as an Acrobat Reader 4, 5, 6, or 7.0 file. Is there a way to save a CS2 .ai file as an Acrobat Reader 9.0+ file while in Illustrator CS2?? Thanks i

  • Trouble changing APEX to serve https...

    I installed 11g with Application Express 3.0.1.00.08. That is the version we are currently working with. It is serving off of 8080 at the moment, but we need it to run on on port 443. Can anyone please point to a GOOD guide on how to set this up? We

  • How can I force the unlock of one  locked resource?

    I have locked a resource, how can I unlock the resource? I try to call unlock function but I receive an error (ORA-31108) Is there a way to force the unlock of a resource locked by other user? thanks