Skip to main content

Posts

Showing posts with the label osgi

AppEngine Cold Startups - Rendezvous with Google App Engine Team

I was at Google App Engine IRC Chat today. Following a lot of concerns of others and of my own , I wanted to put forth my ideas to them about cold startups. I tried to promote my ideas of different approach to classloading, osgi, profiling the runtime itself etc. But time was not enough. I will probably talk again next time. For the most part, It looks like Google is almost ready to come up with *reserved instances* approach. But here is what they have to say. (9:59:52 PM) sar4j: This is about cold startups for java. I run my website sarathonline.com on appegnine py. But I am a java developer. So I have to get reasonabl undersanding about how gae/j works. To simulate the same performance, I am adding a test.js script to exisitng website. So every time a visit comes to gae/py a hit happens to gae/j. I still see that gae/j is very aggressively spinned down. (given number of requests are the same) is there any algorithm on how and when spinning down happens? ..... (10:04:17 PM) api...

Using Equinox CommandProvider to make OSGi console interactive.

After fiddling with the First Bundles that "Hello World"-ed upon Activation, You want to see more interactivity in OSGi. Although Using OSGi for an interactive Command Line Application would be like this one would be, well, a callable over-kill, I am going to start with an example and Expand it in later posts. So, please Welcome CommandProvider. CommandProvider is an EQUINOX specific API for extending the Console. This basic Example illustrates how to get a command from console and do something in java and also gets your feet wet on Service Registry package com.so.examples.commandconsole; import org. eclipse .osgi.framework.console .CommandInterpreter; import org.eclipse.osgi.framework.console.CommandProvider; public class DisplayMessageCommand implements CommandProvider { public void _say(CommandInterpreter ci) { ci.print("You said:" + ci.nextArgument()); } @Override public String getHelp() { return "\tsay - repeats what you say\n"; } }...

OSGi: Starters Guide for Install, Update and Refresh Bundles

In OSGi, with a Bundle you could Install, Update or Refresh. There is a subtle difference in all these three. Just enough for a beginner to entangle the mind. To help, This post gives an a practical insight. I recorded the commands and thier out puts. To Begin with, Install puts a bundle in the framework runtime. It also records the file location (on FileSystem or URL). It doesnot start or resolve dependents on it. sarath@sar-akshaya:~/zbin/equinox$ ls bundles equinox.jar org.eclipse.osgi_3.4.0.v20080605-1900.jar sarath@sar-akshaya:~/zbin/equinox$ ls bundles/ FirstBundle-1.0.0.jar SecondBundle-1.0.0.jar sarath@sar-akshaya:~/zbin/equinox$ java -jar equinox.jar -console osgi> ss Framework is launched. id State Bundle 0 ACTIVE org.eclipse.osgi_3.4.0.v20080605-1900 osgi> install file:bundles/FirstBundle-1.0.0.jar Bundle id is 1 //Try starting osgi> start 1 org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Missing Constraint: ...

Sample ant build file for OSGi bundles

Okay.. after I put the example the other day , I realised it is so worse to be clicking on export and choosing the manifest file all the time. So For a quick start people can use this build.xml <?xml version="1.0" encoding="UTF-8"?> <project name="BundleName" default="deploy" basedir="."> <property name="version" value="1.0.0" /> <property name="src" location="src" /> <property name="build" location="build" /> <property name="deployloc" location="/home/to/equinox/bundles" /> <property name="dist" location="dist" /> <property name="buildfilename" value="${ant.project.name}-${version}.jar"/> <path id="classpath.buildtime"> <pathelement location="/home/to/equinox/equinox.jar" /> <pathelement l...

(NOT) yet Another Getting Started with OSGi

Last week I have been learning OSGi. I got my first application running in OSGi. I am not going to write another getting started post with code that will show a hello world. But rather give you an idea how to start getting in the mud. And then may be show you more than a direction :) I used Equinox 3.4 ( OSGi R4 ) implementation. I prefered it over Felix. Why - Eqinox is simple, and a single jar download. But I guess that aint a thing to notice. You can get Equinox jar from here . If the link is broken, go here , download the equinox framework, it should be ~0.95MB. Start equinox framework as java -jar equinox.jar -console You would have seen this on a lot of sites. but I did fall on two things flat on my face; missing -console and doing it wrong --console :P As per the spec, (and by now, you know ) a bundle is a jar with some special informtion in MANIFIEST.MF. A Bundle jar need not DO anything. It could just sit installed or be active (by exporting packages and services). So ...

MANIFEST.MF in Plain Java, EJB, OSGi - catching the drift

While reading about OSGi, I realised how the importance of MANIFEST.MF has grown over time. The once only-a-jar-information file has had its ups and downs. When I was in school, *chapter jar* was an "assignment" / "reference". It wasn't worth a class' time spent on it. Today a whole new technology relies on this humble text file. Past: Long long ago, in stone age (yeah I am exaggerating), the MANIFEST.MF was auto-generated while jar-ing. More or less it was not used. Well, yeah if you are developing a java application to be distributed to end-users (the jars you used to double click, which are so replaced by jnlp a.k.a WebStart apps now). This file would give a place to specify the class path Manifest-Version: 1.0 Created-By: 1.4.2 (Sun Microsystems Inc.) Main-Class: com.big.long.package.MyAppMain Class-Path: mod1.jar mod2.jar lib/lib.jar This will be set when running java -jar myapp.jar which other wise would have to be something like java -jar myap...

Mission OSGi

Finally some time for OSGi. With release of Spring dm Server, My interest for OSGi got two-fold. Although I did have some close-encounters with OSGi (aah its just a jar called differently - bundle; and MANIFEST.MF drives it all, o I know OSGi), I haven't read into a lot of it. So now, I am diving into it. To start I picked Neil's blog . He also has a draft of his upcoming book, OSGi in Practice . So It is a good place to start. That gives me to start a new tag (osgi) :)