Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

The architecture of aglets

Find out about the inner workings of aglets, IBM Japan's Java-based autonomous software agent technology

  • Print
  • Feedback
>Welcome to another edition of Under The Hood. Up to now, this column has focused on the inner workings of the Java virtual machine (JVM). I've written overviews of the JVM, the class file, and garbage collection, and have covered most of the JVM's bytecode instruction set. I have one final bytecode article coming in June, but this month I am going to begin expanding the column's scope. In the future, I plan to explore a broader array of topics. Each month I will focus on a particular aspect or application of Java technology, explain "how it works," and analyze what it means to Java developers.

This month's article looks at aglets, an innovation developed by IBM Japan.

Aglets: Not just for shoelaces anymore

According to Webster's Ninth New Collegiate Dictionary, an aglet is:

  • aglet 1: the plain or ornamental tag covering the ends of a lace
  • aglet 2: any of various ornamental studs, cords, or pins worn on clothing


In other words, aglets are those little plastic tubes on the ends of your shoelaces. Now, however, there is a new definition of the word aglet: a Java-based autonomous software agent.

As used here, a software agent is a program that can halt itself, ship itself to another computer on the network, and continue execution at the new computer. An agent doesn't restart execution from the beginning at the new computer; it continues where it left off. For example, imagine an agent that increments a counter starting with zero. If that agent counts from zero to ten, then halts and ships itself to another computer, it will not start counting again at zero. It will continue counting starting with ten, because that was where it left off when it halted at its previous computer.

Agents are autonomous because they decide where they will go and what they will do. They control their lifetimes. They can receive requests from external sources, such as other agents, but each individual agent decides whether or not to comply with external requests. Also, agents can decide to perform actions, such as travel across a network to a new computer, independent of any external request.

Aglets versus applets

The Java aglet extends the model of network-mobile code made famous by Java applets. Like an applet, the class files for an aglet can migrate across a network. But unlike applets, when an aglet migrates it also carries its state. An applet is code that can move across a network from a server to a client. An aglet is a running Java program (code and state) that can move from one host to another on a network. In addition, because an aglet carries its state wherever it goes, it can travel sequentially to many destinations on a network, including eventually returning back to its original host.

A Java aglet is similar to an applet in that it runs as a thread (or multiple threads) inside the context of a host Java application. To run applets, a Web browser fires off a Java application to host any applets it may encounter as the user browses from page to page. That application installs a security manager to enforce restrictions on the activities of any untrusted applets. To download an applet's class files, the application creates class loaders that know how to request class files from an HTTP server.

  • Print
  • Feedback

Resources
  • Previous Under The Hood articles:
  • The lean, mean virtual machine -- Gives an introduction to the Java virtual machine. Look here to see how the garbage collected heap fits in with the other parts of the Java virtual machine.
  • The Java class file lifestyle -- Gives an overview to the Java class file, the file format into which all Java programs are compiled.
  • Java's garbage-collected heap -- Gives an overview of garbage collection in general and the garbage-collected heap of the Java virtual machine in particular.
  • Bytecode basics -- Introduces the bytecodes of the Java virtual machine, and discusses primitive types, conversion operations, and stack operations in particular.
  • Floating Point Arithmetic -- Describes the Java virtual machine's floating-point support and the bytecodes that perform floating point operations.
  • Logic and Arithmetic -- Describes the Java virtual machine's support for logical and integer arithmetic, and the related bytecodes.
  • Objects and Arrays -- Describes how the Java virtual machine deals with objects and arrays, and discusses the relevant bytecodes.
  • Exceptions -- Describes how the Java virtual machine deals with exceptions, and discusses the relevant bytecodes.
  • Try-Finally -- Describes how the Java virtual machine implements try-finally clauses, and discusses the relevant bytecodes.
  • Control Flow -- Describes how the Java virtual machine implements control flow and discusses the relevant bytecodes.