This is pretty cool — http://altair.cs.oswego.edu/pipermail/concurrency-interest/2004-September/001035.html

Advertisements

Get an in-depth look at the features and functionality of XMLBeans. This article introduces the technology with a simple example, takes you through the step-by-step process of compilation and binding, and discusses advanced features like XML cursors, tokens, and XQuery expressions. It also discusses how XMLBeans is more powerful than other XML-Java technology data binding techniques.

http://www-106.ibm.com/developerworks/xml/library/x-beans1/

WebLogic and JMX

September 23, 2004

I know I rarely use JMX, the Java Management Extensions (JMX) 1.0 specification that provide open and extensible management services. But there are instances when it’s a great thing to have in your tool-belt, specially dealing with applications deployed in a WebLogic cluster in a distributed environment. As users of WebLogic know, WebLogic Server has implemented JMX 1.0 and added its own set of convenience methods and other extensions to facilitate working in the WebLogic Server.

The WebLogic JMX services expose the management attributes and operations of managed resources through one or more managed beans (MBeans). An MBean is really a concrete Java class that is developed per JMX specifications that provides getters and setters for each attribute. For more information, check out the WebLogic documentation for Programming WebLogic Management Services with JMX.

My usage of JMX is fairly limited and it’s usually something simple like discovering all the names and addresses of managed servers in a cluster. For redundancy and fault tolerance, I will create caches of data at the individual server level (No, we don’t use Coherence :)) that need to be managed across the cluster. My typical pattern is to create a simple admin servlet that sits in each member of the cluster and interacts with the cache via the exposed destroy, reset, display, etc operations. Here’s a snippet of code that allows you to discover members of a WebLogic cluster:

        try {
            Environment env = new Environment();
            env.setProviderUrl("t3://adminserver:port");
            env.setSecurityPrincipal("username");
            env.setSecurityCredentials("password");
            Context ctx = env.getInitialContext();
            home = (MBeanHome) ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);
        } catch (NamingException e) {
            System.out.println("Exception caught: " + e);
            //do something useful here 
            //         } 

            if (home != null) {
                System.out.println("Active Domain: " + home.getActiveDomain().getName());
            } 
	
            //getting the names of servers in the domain
            System.out.println("Active Servers: ");
            Set mbeanSet = home.getMBeansByType("ServerRuntime");
            Iterator mbeanIterator = mbeanSet.iterator();

            while (mbeanIterator.hasNext()) {
                ServerRuntimeMBean serverRuntime = (ServerRuntimeMBean) mbeanIterator.next();

                if (serverRuntime.getState().equals(ServerStates.RUNNING)) {

                    if (!serverRuntime.isAdminServer()) {
                        String[] serverName = serverRuntime.getListenAddress().split("/");
                        String serverURL = "http://" + serverName[1] + ":" + serverRuntime.getListenPort();
                        reloadCache(serverURL);
                    }
                }
            }

More information is at dev2dev.bea.com and Programming WebLogic Management Services with JMX.

Hibernate in Action

September 20, 2004

My copy of Hibernate in Action finally arrived on Friday and I am excited to read it, but it seems like my 2 month old daughter, Katie has her eye on it. ) I guess I’ll have to wait till she’s done.

Parsing and Processing Large XML Documents with Digester Rules by Eugene Kuleshov — In-memory XML representations such as DOM can be impractical for large XML files, for which different approaches are needed. As Eugene Kuleshov shows, Jakarta Digester offers a lighter, event-driven alternative.

Pyramid Scheme

September 2, 2004

Ok. I am an idiot! I’m sure you’ve read about the pyramid scheme going around that promises free iPod’s. According to Wired Magazine, this is a new marketing effort and not a scam and so I’ve signed up for it. I know. I know. I am an idiot

The deal is that you sign up for one of the various online promotions and persuade five other people to participate to get your iPod. Check it out @ FreeiPods.com