Alternative to Static Class Inherit

Greetings,
I’ve been using some code for years in a different number of applications but that involves a lot of copy paste and is a nightmare to maintain. For that reason I’ve took some time to re-organize some of my codes and that mainly involves
splitting it into multiple projects for latter inclusion in a number of solutions.
So far so good and I’d say 95% is done but I’m now stuck with a Static Class I need to use. I basically need a few “Global” parameters and settings to be available across every solution. I know I can’t Inherit a Static Class nor override
a Field to return a different value unfortunately.
In a nutshell:
myFrameworkProject
namespace
myFramework.Classes{
                //these contains general stuff
used in every project
                public static class Globals{
                               public static
XPTO veryImportantProperty = new XPTO()
                               public static
Settings Settings = new Settings();
public void doSomethingImportant();
Public class Settings{
                Private
string Username;
                Private
string Password;
                Private
string Whatever;
myFancyProject
namespace
myFancyProject.Classes{
                //these add specific stuff used
in this project
                public static class Globals : myFramework.Classes.
Globals {
                               public static
override mySettings Settings = new mySettings();
Public class mySettings: myFramework.Classes .Settings{
                //some
more specific settings I need
                Private
string SomethingElse;
What are my options? I’ve been trying to play with Singletons but for some reason I just can’t seem to make it work the way I want to…probably because it’s just not the right way to do it in the first place.

I think you are over thinking it a little bit. The example you have above would be great if you had multiple setting types you wanted to retrieve within the same application domain instance using keys or specific types. The way I understand your problem
is you have one settings type per application that you run with various applications sharing a code base. Here is an example I created for you which better illustrates the solution I had in mind when I read your problem.
There are 2 namespaces, the one for your custom project(s) named FancyProject and then the Core / framework. Hope this helps!
namespace JF.FancyProject
using JF.Framework.Classes;
// in initialization of your default application domain (ie. in your application startup)
// inject your MySingleton with your custom implementation of ISettingsBuilder
// this can be done in many ways from hard coding in each startup routine to IoC / Dependency Injection
// the end result is this
public static class Console
public static void Main(params string[] args)
MySingleton.Initialize(new ConcreteSettingsBuilder());
// now you can use it where ever
var temp = MySingleton.SettingsConcreteInstance<ConcreteSettings>().SomethingCustom;
// or base
var temp1 = MySingleton.SettingsInstance.SomeBaseThing;
public sealed class ConcreteSettings : JF.Framework.Classes.SettingsBase
public string SomethingCustom { get; set; }
public sealed class ConcreteSettingsBuilder : BaseSettingsBuilder, ISettingsBuilder
public override SettingsBase CreateSettings()
var settings = new ConcreteSettings();
// call the base if you need to get standard settings populated
base.populateBaseSettings(settings);
// populate all of your custom settings
return settings;
namespace JF.Framework.Classes
public abstract class SettingsBase
public string SomeBaseThing { get; set; }
// base settings and behavior that can be abstracted
public static class MySingleton
private static SettingsBase _settings;
private static Lazy<SettingsBase> _lazyCreationMethod;
public static void Initialize(ISettingsBuilder builder)
_lazyCreationMethod = new Lazy<SettingsBase>(builder.CreateSettings);
public static SettingsBase SettingsInstance
get { return _lazyCreationMethod.Value; }
public static T SettingsConcreteInstance<T>() where T : SettingsBase
return (T) _lazyCreationMethod.Value;
public abstract class BaseSettingsBuilder : ISettingsBuilder
public abstract SettingsBase CreateSettings();
protected virtual void populateBaseSettings(SettingsBase settings)
// if you find many of your settings are created the same way use a base class
public interface ISettingsBuilder
SettingsBase CreateSettings();
Edit:
One more thought. I do agree with some of the other posters that  for bigger projects the use of a Singleton pattern is not a good idea. For little applications it does not matter too much because chances are there is not enough substance that it will
hinder your code and the development cycles are generally very short.
Should you want to reconsider the Singleton pattern then I recommend you look at something like
Autofac, you could use this to inject instances of your ISettingsBuilder, or other concrete instances, directly into your dependent classes and you could take it further in developing self containing services that you could
inject as well.
Again, for small projects its not a big deal but if you ever start on something a bit more complex its worth looking into.
-Igor

Similar Messages

  • Static Class JMS Listener

    I am designing an EJB component (MessageDrivenBean) that requires
    dynamic ("hot") configuration changes. As such, the bean must be
    notified somehow of configuration changes in the DB (rather than have
    to poll the DB for changes at every method call).
    I'm thinking of implementing this functionality using a static class
    instance (singleton) that is shared between the multiple instances of
    the bean. This static instance would listen on a JMS topic for
    configuration change events and update its internal cache accordingly
    (by getting the configuration information from the DB). The beans
    would then access this in-memory static instance everytime they need
    configuration info instead of polling the database. By using the JMS
    topic, I guarantee that clustered instances of Weblogic will all be
    notified of the database changes (each instance would have its own
    "cache" singleton).
    I'm pretty sure all of this will work, but I'm equally sure that I'm
    violating some EJB rules. Singletons and JMS listeners are generally
    discouraged. Are there any alternatives to this design?

    Hi Joost,
    This all seems to be pretty complicated. Not to mention that you can not
    guarantee that members of a cluster will be notified simultaneously.
    Why don't you want using the database?
    "Joost Ouwerkerk" <[email protected]> wrote in message
    news:[email protected]..
    I am designing an EJB component (MessageDrivenBean) that requires
    dynamic ("hot") configuration changes. As such, the bean must be
    notified somehow of configuration changes in the DB (rather than have
    to poll the DB for changes at every method call).
    I'm thinking of implementing this functionality using a static class
    instance (singleton) that is shared between the multiple instances of
    the bean. This static instance would listen on a JMS topic for
    configuration change events and update its internal cache accordingly
    (by getting the configuration information from the DB). The beans
    would then access this in-memory static instance everytime they need
    configuration info instead of polling the database. By using the JMS
    topic, I guarantee that clustered instances of Weblogic will all be
    notified of the database changes (each instance would have its own
    "cache" singleton).
    I'm pretty sure all of this will work, but I'm equally sure that I'm
    violating some EJB rules. Singletons and JMS listeners are generally
    discouraged. Are there any alternatives to this design?Regards,
    Slava Imeshev

  • Purpose of static classes

    What is the purpose of making a class static?
    public static class December {
    }The only reason I can see is to access inner-classes without instantiating the outer-class? Are there any other?

    see these
    http://forum.java.sun.com/thread.jsp?forum=31&thread=277820
    http://forum.java.sun.com/thread.jsp?forum=31&thread=305260

  • Creation of a static class with private methods

    I'm new to java programming and am working on a project where I need to have a static class that does a postage calculation that must contain 2 private methods, one for first class and one for priority mail. I can't seem to figure out how to get the weight into the class to do the calculations or how to call the two private methods so that when one of my other classes calls on this class, it retrieves the correct postage. I've got all my other classes working correct and retrieving the information required. I need to use the weight from another class and return a "double". Help!!!
    Here's my code:
    * <p>Title: Order Control </p>
    * <p>Description: Order Control Calculator using methods and classes</p>
    * <p>Copyright: Copyright (c) 2002</p>
    * <p>Company: Info 250, sec 001, T/TH 0930</p>
    * @author Peggy Blake
    * @version 1.0, 10/29/02
    import javax.swing.*;
    public class ShippingCalculator
    static double firstClass, priorityMail;
    //how do I get my weight from another class into this method to use??? not sure I understand how it works.
    public static double ShippingCalculator(double weight)
    String responseFirstClass;
    double quantity, shippingCost;
    double totalFirstClass, firstClass, priorityMail, totalShipping;
    double priorityMail1 = 3.50d;//prioritymail fee up to 1 pound
    double priorityMail2 = 3.95d;//prioritymail fee up to 2 pounds
    double priorityMail3 = 5.20d;//prioritymail fee up to 3 pounds
    double priorityMail4 = 6.45d;//prioritymail fee up to 4 pounds
    double priorityMail5 = 7.70d;//prioritymail fee up to 5 pounds
    quantity = 0d;//ititialization of quantity
    // weight = 0d;//initialization of weight
    // shippingCost = 0d;
    //calculation of the number of items ordered..each item weights .75 ounces
    quantity = (weight/.75);
    if (quantity <= 30d)
    //add 1 ounce to quantities that weigh less than 30 ounces
    weight = (weight + 1);
    else
    //add 2 ounces to quantities that weigh more than 30 ounces
    weight = (weight + 2);
    if (weight > 80d)
    //message to orderclerk ..order over 5 lbs, cannot process
    JOptionPane.showMessageDialog(null, "Order exceeded 5 lbs, cannot process");
    //exit system, do not process anything else
    System.exit (0);
    else
    if (weight < 14d)
    //send message to customer: ship firstclass or priority, y or n
    responseFirstClass = JOptionPane.showInputDialog(null, "Ship first class? y or n?");
    if (responseFirstClass.equals("y"))
    //compute FirstClass shipping cost
    totalFirstClass = ((weight - 1) * .23d) + .34d;
    firstClass = totalFirstClass;
    else
    //compute PriorityMail cost for orders less than 14 ounces
    priorityMail = (priorityMail1);
    else
    if (weight <=16d)
    //compute totalshipping for orders up to 16 ounces
    priorityMail = (priorityMail1);
    else
    if (weight <=32d)
    //compute totalshipping for orders up to 32 ounces
    priorityMail = (priorityMail2);
    else
    if (weight <=48d)
    //compute totalshipping for orders up to 48 ounces
    priorityMail = (priorityMail3);
    else
    if (weight <= 64d)
    //compute totalshipping for orders up to 64 ounces
    priorityMail = (priorityMail4);
    else
    //compute totalshipping for orders up to 80 ounces
    priorityMail = (priorityMail5);
    priorityMail = 0d;
    firstClass = 0d;
    firstClassMail ();
    priorityMailCost ();
    //I think this is where I should be pulling the two methods below into my code, but can't figure out how to do it.
    shippingCost = priorityMail + firstClass;
    return (shippingCost);
    }//end method calculate shipping
    private static double firstClassMail()//method to get first class ship cost
    return (firstClass);
    }//end method firstclass shipping
    private static double priorityMailCost()//method to get priority mail cost
    return (priorityMail);
    }//end method priorityMail
    }//end class shipping calculator

    public class A {
    public String getXXX () {
    public class B {
    A a = new A();
    public void init () {
    a.getXXX();
    }

  • Do static classes persist for the lifetime of the applet or the JRE in 1.4

    I have an application that runs in a web browser and uses several applets that share data between each other using a static class. This method works fine for version 1.3 but not in 1.4.x. Do static classes now only exist for the lifetime of the applet?

    I had a similar problem and solved it by setting the codebase attribute on the applet tags. The only documentation I have been able to find about this issue is here: http://java.sun.com/products/plugin/1.3.1_01a/new.html#classloader

  • Usage of non static members in a static class

    Can you explain the usage of nonstatic members in a static class?

    Skydev2u wrote:
    I just recently started learning Java so I probably know less than you do. But from what I've learned so far a static class is a class that you can only have one instance of, like the main method. As far as non static members in a static class I think it allows the user to modify some content of the class(variables) even though the class is static. A quick Google help should help though.Actually the idea behind a static class is that you dont have any instances of it at all, its more of a place holder for things that dont have anywhere to live.
    Non-static members in a static class wouldnt have much use

  • Attributes of private static class - private or package private?

    Consider the following code:
    public class Outer {
        // Remainder omitted
        private static class Nested {
            int someInt           = 10;
            String someString = "abc";
    }The nested class Nested is declared private, as it is only used by the Outer class... now I wonder... should I declare Nested's attributes private oder package private... either way, they can't be accessed from the outside... any ideas?

    stevops wrote:
    either way, they can't be accessed from the outsideThat is true. However, when in addition the members of class Nested are declared as private, you will not be able to access them also from within the class Outer as well, i.e. int i = Nested.someInt; will give you compliation errorsAs a matter of fact, at most it'll generate some warnings, for it (the compiler) will generate synthetic accessor methods for Nested's fields.
    All in all, if you plan to access private class members from an enclosing (or inner) class, you really only have two options: make them explicitly package-private, or make them implicitly so.

  • Releasing static classes in a browser environment

    Hi all, got a problem I can't seem to find a solution for, so hoping someone knows what to do with this!
    I'm running a Java applet in a browser, under Sun's JVM. It has a custom dynamic class loader, which queries our server and downloads patches to the software. However, this doesn't work entirely as planned. The JVM doesn't seem to want to clear the class cache until the browser is restarted. I'm also wondering about static class definitions and whether I'd have to do something different to refresh those too.
    Ideally, when the loader starts and downloads patches to files, it then completely wipes out its previous definitions of cached classes, and reloads them all again from disk. Is this possible, and how would I go about doing it?
    (The reason for this behaviour is my old old software ran on Java 1.1, and the MS Java plugin exhibits this behaviour, which our users were used to...)
    Thanks in advance!
    David

    Thanks for the quick reply :)
    The loader is not static, so it should be using a new
    instance each time already? Or is it not sufficient
    to simply make it not static?Not really sure how to answer that! It's not static, so presumably it's an instance field of some other class. Now, are you using a new instance of that object each time you download a new patch? If not, that'll probably be the problem. If so, then probably what's going on is, your classloader isn't loading the classes at all, but simply delegating to it's parent. If that's the case, you need to make that delegation fail, for example by not giving your classloader a parent

  • Can we create static class in actionscript 3.0

    Hi If yes please send me chunk of code .
    thanks

    Hi Prashanth,
    There is no specifically a Static class in Flex that you can declare it at the compile time. However you can have Static variables and methods in your class and you can call them using the class name itself without creating an instance of that class.
    Here is the chunk of code...
    package com.constants
    [Bindable]
    public class ConsumerMessageConstants
      public static const UNABLE_TO_ENROLL_PLANS_MESSAGE_ID:String = "10000";
      public static const MARITAL_STATUS_UPDATED_MESSAGE_ID:String = "10001";
      public static const ERROR_IN_EDITING_MARITALSTAUS_MESSAGE_ID:String = "10002";
      public static const SMOKER_STATUS_SAVED_SUCCESSFULLY_MESSAGE_ID:String = "10003";
      public static const PASSWORD_RESET_REQUIRED_MESSAGE_ID:String = "10004";
      public static const ADDRESS_UPDATED_SUCCESSFULLY_MESSAGE_ID:String = "10005";
      public static const UNABLE_TO_REMOVE_THIS_DEPENDENT_MESSAGE_ID:String = "10006";
      public static const EMPLOYEE_SALARY_UPDATED_SUCCESSFULLY_MESSAGE_ID:String = "10007";
      public static const ERROR_IN_EDITING_SALARY_MESSAGE_ID:String = "10008";
      public static const PLEASE_SELECT_A_CONSIDER_PLAN_MESSAGE_ID:String = "10009";
      public static const YOU_MUST_CHOOSE_A_PLAN_COVERAGE_LEVEL_MESSAGE_ID:String = "10010";
      public static const PLEASE_SELECT_PLAN_TO_LOCK_PORTFOLIO_MESSAGE_ID:String = "10011";
      public static const DEEPDIVE_INFORMATION_SAVED_SUCCESSFULLY_MESSAGE_ID:String = "10012";
      public static const NO_DATA_TO_DISPLAY_MESSAGE_ID:String = "10013";
      public static const NO_PLANS_AVAILABLE_TO_ENROLL_MESSAGE_ID:String = "10014";
      public static const NO_PLANS_TO_BE_ENROLLED_MESSAGE_ID:String = "10015";
      public static const PASSWORD_CHANGED_SUCCESSFULLY_MESSAGE_ID:String = "10016";
      public static const NEW_PASSWORD_AND_CONFIRM_PASSWORD_SAME_MESSAGE_ID:String = "10017";
      public static const YOUR_DATA_IS_UPDATED_SUCCESSFULLY_MESSAGE_ID:String = "10018";
      public static const HEALTH_PLAN_IS_UPDATED_SUCCESSFULLY_MESSAGE_ID:String = "10019";
      public static const HEALTH_PLAN_IS_ADDED_SUCCESSFULLY_MESSAGE_ID:String = "10020";
      public static const MONEY_PLAN_IS_UPDATED_SUCCESSFULLY_MESSAGE_ID:String = "10021";
      public static const MONEY_PLAN_IS_ADDED_SUCCESSFULLY_MESSAGE_ID:String = "10022";
      public static const PROTECTION_PLAN_IS_UPDATED_SUCCESSFULLY_MESSAGE_ID:String = "10023";
      public static const PROTECTION_PLAN_IS_ADDED_SUCCESSFULLY_MESSAGE_ID:String = "10024";
      public static const UNABLE_TO_RETRIEVE_PATHS_MESSAGE_ID:String = "10025";
      public static function func1():Void
      public static function func2():Void
      public function ConsumerMessageConstants()

  • Static class garbage collection

    Can garbage collector can garbage collect static classes ?.
    My doubt is that when you access a static class , that class is loaded through its class loader ( when first time that class is referenced ).
    So when did the garbage collector collects this static class ( assume that static class no longer referred ).
    Please do more information,
    What are the ways to prevent garbage collector for a particular class ( Assume that i m implementing a singleton for my java runtime)
    thanks and regards
    Renjith.

    Can garbage collector can garbage collect static classes ?. Static classes are nothing special in terms of class loading - they are only different in visibility for linking.
    Perhaps you mean static members of classes?
    My doubt is that when you access a static class ,
    that class is loaded through its class loader ( when
    first time that class is referenced ). Classes are always loaded through classloaders. Objects of those classes are allocated from the heap, and the object instances refer to the class object.
    Objects (either instances, or classes themselves) are garbage collected when they are no longer live (i.e. no live object refers to them). (This is a somewhat recursive definition, and sometimes, you can have cyclic dependencies that make garbage collection tricky, but the GC, while it has to be conservative for correctness, usually gets it right).
    So for a static member to be garbage-collected, the class has to be garbage-collected first. The class cannot be GC'ed until all references to it go away (this includes all dynamically allocated objects of that type, and the class loader that loaded that class).
    And yes, class loaders can go away, but only if they are created by your program. The system class loader (which is the default classloader you get if you don't create any class loaders of your own) never goes away, so any class loaded from CLASSPATH will never be unloaded.
    (As an example, servlet containers - e.g. Tomcat, Weblogic, etc.) allocate one or more classloaders for each webapp. When the webapp is un-deployed, the classloaders are "orphaned", and they, and any classes loaded by them (from the WEB-INF/lib and WEB-INF/classes directories) are unloaded and garbage-collected. (After all the dynamic objects of those classes are GC'ed, of course).
    >
    So when did the garbage collector collects this
    static class ( assume that static class no longer
    referred ).
    Please do more information,
    What are the ways to prevent garbage collector for a
    particular class ( Assume that i m implementing a
    singleton for my java runtime)
    thanks and regards
    Renjith.

  • Static class variable

    Folks:
    I am little confused by static class variables in Java. Since Java doesn't have global varaibles it uses static variables instead. Please take a look at the following code and please tell me what goes wrong.
    /********** CONTENT OF Stack.java ***********/
    import java.util.Stack;
    public class StackClass
    {   static  Stack stack = new Stack (); }
    /********** CONTENT OF Test1 .java ***********/
    public class Test1
    public static void main( String[] args )
    StackClass.stack.push("Hello World");
    /********** CONTENT OF Test2.java ***********/
    public class Test2
    public static void main( String[] args )
    System.out.println( "Top on stack is " + StackClass.stack.peek() );
    I execute the above programs in the sequence of StackClass.java, Test1.java and Test2.java. I think in Test1.java after I push one element to the stack it should still be in the stack in Test2.java But I got :
    java.util.EmptyStackException
         at java.util.Stack.peek(Unknown Source)
         at Test2.main(Test2.java:16)
    Exception in thread "main"
    Can anybody give me a hint?
    Thanks a lot !

    After you run StackClass, the JVM (java.exe) ends and all the classes are unloaded including StackClass
    When you run Test1, StackClass is loaded, an item is pushed on the stack, and then the JVM exits and all classes are unloaded including StackClass
    When you run Test2, StackClass is loaded, and you get an error because the StackClass which was just loaded has no items in it.

  • Static class reference

    Below we have a class containing a static class variable and a static accessor method.
    The method is responsible for assigning the variable, which it does on demand.
    public class MyClass
        private static int INFO = -1;
        public static int getInfo()
            if(INFO < 0)
                try
                    INFO = ...;
                catch(Exception e)
            return INFO;
        }When using this class is it not safe to assume that the assignment of the variable will ever only occur once for the life of the system that uses this class? (afterall is it static within the class)
    I am experiencing the situation whereby EVERY time the method is called, the assignment of the variable is necessary. I can only assume that the static instance of this class in memory has been lost between each call and therefore the state/value of the variable has also been lost.
    It is worth noting that no object instances of this class are ever created. The class is accessed only through its static interface. It seems that since no local reference to objects of this class are held in memory then the entire class, along with its internal static state, is cleared from memory (garbage collected?).
    How is it possible to ensure that the state of static fields within such a class is preserved over time, without create instances of the class.
    John

    When using this class is it not safe to assume that
    the assignment of the variable will ever only occur
    once for the life of the system that uses this class?First of all, you haven't said what you assign it to, so we can't say. If you assign a value less than zero then it will be reassigned next time the method is called.
    Secondly, it depends on whether or not you're expecting it to be thread-safe? It isn't.
    If your code is not multi-threaded, then the section of code in your getInfo method that assigns the field should only execute once during a single run of an application.
    Thirdly, you explicitly assign it (to minus one) at class initialisation time, so stricty speaking, the variale will always be assigned at least once, and will be assigned at least once more if the getInfo method is ever called.
    I am experiencing the situation whereby EVERY time the
    method is called, the assignment of the variable is
    necessary. Can you offer any evidence to this? A small, complete, compilable and executable example that demonstrates the problem will help, and will probably get you an answer pretty quickly around here.
    I can only assume that the static instance
    of this class in memory has been lost between each
    call and therefore the state/value of the variable has
    also been lost.Then either there is a bug in your JVM, or at least two versions of the class have been loaded, and at least one of those was not loaded by the system classloader. Without further info, we aren't going to be able to help much more here.
    The class is accessed only
    through its static interface. It seems that since no
    local reference to objects of this class are held in
    memory then the entire class, along with its internal
    static state, is cleared from memory (garbage
    collected?).This is not allowed under the JLS if the class was loaded by the system classloader. If it was loaded by another classloader, then it is only allowed if it can be determined that the class will never again be used throughout the entire run of the application. Since you are referencing the class again, this should not be happening.
    How is it possible to ensure that the state of static
    fields within such a class is preserved over time,
    without create instances of the class.From what you have told us so far, it should be. You will probably have to provide some code for us to help you further.

  • Static class

    Hello
    at the start of my programme I would like to store some valuse (the values are trhe user rights that will be read from the data base) these values will never change during the execution of the programme.
    so I was told that the best is to create a static class ...
    can any one post an example of static class and how to store the values inside
    and how to read it back
    or just any link that speak about this
    thank you in advance.

    yeah i understand the ?:;
    my question was on the form of the newthe code checks to see if an instance of Example already exists, and if it does, it returns that. if not, it creates a new one first. theoretically, only one instance will ever exist, but in practice, this variant of the pattern isn't thread-safe. simplest singleton:
    public class MySingleton {
      private static MySingleton INSTANCE = new MySingleton();
      private MySingleton() {}
      public static MySingleton getInstance() {
        return INSTANCE;
    }still lazily-loaded, despite what people might tell you, since the class itself is only loaded when you first need it

  • Static class definition in flex

    Hi friends,
    can any one,please provide me with some example of defining static class in flex and acessing it in mxml page.
    one more thing i want to make clear,static class is nothing but .as class. Am i Right?
    thanks in Advace!!!!

    > may u know what is the difference between mx: and s:
    Flex actually has two sets of components, the original "MX" components from Flex 1.0 and the newer "Spark" components introduced in Flex 4.0. The Spark components support a much better skinning model.
    In terms of ActionScript classes, the two versions of Application are mx.core.Application and spark.components.Application. The MXML tags that map to these classes are normally written as <mx:Application> and <s:Application>, although the mx: and s: prefixes are completely arbitrary. What is important is the URIs declared for xmlns:mx="..." and xmlns:s="...". These URIs represent the SWCs containing these components, and the SWCs have "manifest" information about the mapping of tags to classes.
    Gordon Smith
    Adobe Flex SDK Team

  • Static class and clustering

              I have a static class that I use to cache some values during a batch process. The
              batch process uses a JMS queue to parcel our identical units of work to MDBs.
              I want this to scale using a cluster with the same MDBs on multiple machines.
              Everything works fine except that I can't figure out how to tell my cache to clear
              itself out on every node between batch runs. Is there a pattern or solution to
              this problem?
              What I've tried is to create a stateless session bean method that clears my cache.
              At the begining of my batch job, (which is a stateless session bean call) I call
              this method on each server in the cluster by getting the remote interface for
              the stateless bean via the different URLs of the servers. However, the session
              bean method always executes on the one server where I make the call. It's as if
              WebLogic gives me back a local interface instead of the remote interface that
              I asked for.
              Any ideas would be appreciated.
              Colin
              

    ... static class and static method.I have never heard of a thing called "static class". Perhaps you mean a class with only static members?
    My design approach (which is bound to needs of the moment and seldom to library-development or future re-use, since both is harder than most developers realize) is to develop straight without caring too much about static or not. When a method is done, debugged and works well, it happens that other objects access this method as well.
    It may happen that I just want to use this single method and almost nothing else of the object. If that is the case, I can start looking if it's a Good Thing(tm) to make the method static, so no object creation is needed just for the one method. Sometimes it can be done, sometimes not.
    But that's just me and you'll find quite a lot of coders that'll advice you to decide what's static and what not before you start coding. And that's as good an advice as most others you can get.
    In the end it's your decision, so start fiddling around and see what fits best for you.
    -T-

Maybe you are looking for

  • 15" MacBook Pro (Late 2008) Hard Freezing & Apple Refusing Support

    Hi all, I have tried installing Microsoft Windows XP / Vista / Vista SP1 32-bit and 64-bit on my 15" Unibody MacBook Pro, and in all instances the machine has hard locked up / froze randomly, which can only be rectified by a hard reboot. Sometimes th

  • CORRECT DRIVER FOR WINDOWS 7 AND HP COLOR LASER JET 4600dn

    I'm having a problem with our IT department.  My old 4600dn worked great until they started downloading new drivers for Windows 7, which they installed just recently.  Now the one he INSISTS I use has only one tray selection.... Auto.  I'm trying to

  • How to generate an s-curve graph/chart in labview

    I would like to generate my s-curve shape in a visible graph in a labview vi. Are there any quick/dirty vi's that can take position, accel/decel, vel and jerk value, and plot this into a time graph? Something akin Motion Assistant... I am able to con

  • Best practice identifying ERT modules with SAP / IS-Utilities

    Hi everybody, I'm looking for the best practice identifying ERT modules with SAP / IS-Utilities (electricity). Here's the physical device set up : The ERT modules are internal to the electricity meter. They're integrated into a multi purpose electron

  • 10.6 on 32 bit intels?

    Can't seem to find it, but any one know if Snow Leopard will install and run ok on 32 bit intel core duo MacBook Pros?