Discussions

News: Dan Creswell: How to write a JINI Service

  1. Dan Creswell: How to write a JINI Service (51 messages)

    Dan Creswell, in "How to write a JINI Service," shows the simplest of simple JINI services including support for the service starter, a reasonable amount of control over reggie discovery/registration ("reggie" being the JINI lookup service), codebase and configuration.

    He walks through the entire deployment process, including defining the interface, writing the service implementation, building a .jar, and writing the configuration files (a step often slightly skipped in J2EE deployment tutorials, when considering application-server settings like security configuration), and running the service.

    His conclusion:
    Writing a JINI service isn't any more difficult than writing an RMI service. We've used a fair number of built in JINI facilities like the service-starter which we don't need to use but it saves aggravation in the long run because it gives us easy configuration facilities (including fully remote deployment with everything sourced from a webserver), removes all the nasty boot code boilerplate (like setting a security manager).
    However, considering the amount of code in the tutorial, the question has to be asked: is there a simpler way to approach this? Should there be?

    Threaded Messages (51)

  2. Hi,

    Isn't JINI a technology in coma dying a very slow death?

    J
  3. Hi,Isn't JINI a technology in coma dying a very slow death?J

    you're an idiot.

    c
  4. Dan Creswell: How to write a JINI Service[ Go to top ]

    Hi,Isn't JINI a technology in coma dying a very slow death?J
    you're an idiot.c

    Do we have to sink to the level of Slashdot? Surely a better response is to provide evidence of continued use of and interest in JINI rather than personal insults?
  5. Dan Creswell: How to write a JINI Service[ Go to top ]

    Jini is one of those things that is used, but few talk about. Check out what Orbitz is doing (very cool stuff) and see look at Gigaspaces. Some [more] incredible things can be done with Jini if more people would look at it - instead of the typical web ui/app server/database. I had talked to someone at IBM and that were using Jini to provide printing services.
  6. Dan Creswell: How to write a JINI Service[ Go to top ]

    Jini is one of those things that is used, but few talk about. Check out what Orbitz is doing (very cool stuff) and see look at Gigaspaces. Some [more] incredible things can be done with Jini if more people would look at it - instead of the typical web ui/app server/database. I had talked to someone at IBM and that were using Jini to provide printing services.

    Yes, and you can find others here: http://www.lonecrusader.co.uk/success.html

    And that doesn't include several other companies who have asked to remain anonymous (I'm working on changing their minds).

    The blog entry itself has attracted significant interest netting several thousand hits since I posted it before New Year and it's deemed popular over at del.icio.us right now.
  7. Yes, and you can find others here: http://www.lonecrusader.co.uk/success.htmlAnd that doesn't include several other companies who have asked to remain anonymous (I'm working on changing their minds).The blog entry itself has attracted significant interest netting several thousand hits since I posted it before New Year and it's deemed popular over at del.icio.us right now.

    Forgot some others too:

    http://www.incax.com

    http://www.netcaboodle.com

    http://www.zink-digital.com/
  8. And one more - Lockheed Martin:

    http://www.jini.org/meetings/ninth/J9Program_W.html

    http://www.jini.org/webinar/0904/0904_abstract.html
  9. Dan Creswell: How to write a JINI Service[ Go to top ]

    Isn't there an large insurance company using it?
  10. Dan Creswell: How to write a JINI Service[ Go to top ]

    Isn't there an large insurance company using it?

    I assume you mean Countrywide? If not, you might have to spell it out for everyone cos my brain's fried and I can't remember.
  11. Dan Creswell: How to write a JINI Service[ Go to top ]

    Isn't there an large insurance company using it?
    I assume you mean Countrywide? If not, you might have to spell it out for everyone cos my brain's fried and I can't remember.
    I would have if I could have remembered. I had read it somewhere in the past, then couldn't find it again.
  12. Insurance Company doing JINI????[ Go to top ]

    Still not entirely sure this is the company Mark was thinking about but Countrywide featured their work at the 7th JCM - check out Calum Shaw-Mackay's presentation:

    http://www.jini.org/meetings/seventh/J7Program_T.html

    A number of the bits of infrastructure he mentions are actively being developed and are open source (Neon for example).
  13. Dan Creswell: How to write a JINI Service[ Go to top ]

    Hi,Isn't JINI a technology in coma dying a very slow death?J
    you're an idiot.c
    Do we have to sink to the level of Slashdot? Surely a better response is to provide evidence of continued use of and interest in JINI rather than personal insults?

    Sincerest apologies. This post caught me at a (very) bad moment. It can be frustrating to see people propogating FUD about things they clearly know nothing about. IMHO the Jini body of work is some of the most inspiring Java technology around. The fact that parts of it are slightly more complex than the majority of frameworks discussed on TSS is simply a reflection of the difficulties inherent in the problems Jini is trying to solve.

    c
  14. Dan Creswell: How to write a JINI Service[ Go to top ]

    It can be frustrating to see people propogating FUD about things they clearly know nothing about.

    Oh I agree!
    IMHO the Jini body of work is some of the most inspiring Java technology around.

    I agree even more. My personal interest is in JavaSpaces, which I think is one of the most interesting and under-used technologies ever (I have past experience in distributed numerical computation - I would have loved to have Jini/JavaSpaces many years ago).

    I have found that a calm response along with evidence to back your case can be even more annoying to a debating opponent :)
  15. My personal interest is in JavaSpaces, which I think is one of the most interesting and under-used technologies ever (I have past experience in distributed numerical computation - I would have loved to have Jini/JavaSpaces many years ago).

    If you are acquainted with distributed numerical computation, then you'll really like the data grid capabilities in our Coherence 3.1 release. Coherence dynamically load-balances both the data and the computations across any number of servers. The computations themselves are performed at in-memory speed, since no data are being moved around the network to achieve the computations.

    We already have some of the biggest risk-management systems in the world running on Coherence, and they were the starting point for designing these features. This idea was originally implemented in Coherence by the world's largest bank using our Invocation Service coupled with our Partitioned Cache Service, but the data grid capabilities are now built into the Partitioned Service itself.

    Peace,

    Cameron Purdy
    Tangosol Coherence: Clustered Shared Memory for Java
  16. I have past experience in distributed numerical computation

    If you are acquainted with distributed numerical computation, then you'll really like the data grid capabilities in our Coherence 3.1 release.

    I posted some more information on the new data grid capabilities on my blog:

    http://jroller.com/page/cpurdy?entry=data_grid_in_action

    Enjoy!

    Peace,

    Cameron Purdy
    Tangosol Coherence: Clustered Shared Memory for Java
  17. Dan Creswell: How to write a JINI Service[ Go to top ]

    I have past experience in distributed numerical computation
    If you are acquainted with distributed numerical computation, then you'll really like the data grid capabilities in our Coherence 3.1 release.
    I posted some more information on the new data grid capabilities on my blog:http://jroller.com/page/cpurdy?entry=data_grid_in_actionEnjoy!Peace,Cameron PurdyTangosol Coherence: Clustered Shared Memory for Java
    I never knew a hashmap was so useful/powerful. ;) :)
  18. Dan Creswell: How to write a JINI Service[ Go to top ]

    I never knew a hashmap was so useful/powerful. ;) :)

    It's an Enterprise HashMap ;-)

    (We call Coherence a "coherent cache" because that's what a lot of people use it for, but it is a fully coherent object space that happens to provide the standard java.util.Map API regardless of the selected data topology and regardless of the number of servers. There is no more natural API in Java for a space than the Map API; as Dan can tell you, I have big problems with the JavaSpaces API because -- IMHO -- it feels totally un-natural to a Java developer.)

    Peace,

    Cameron Purdy
    Tangosol Coherence: Clustered Shared Memory for Java
  19. Dan Creswell: How to write a JINI Service[ Go to top ]

    <s Dan can tell you, I have big problems with the JavaSpaces
    I've seen some things you've posted about Jini. I understand the "un-natural" part. I have trouble enough trying to get people to use something other than their standard report tool.

    Oddly, I think tuples are built into Ruby.
  20. as Dan can tell you, I have big problems with the JavaSpaces API because -- IMHO -- it feels totally un-natural to a Java developer.)

    In respect of un-natural, I think "different" may be a better term. If all we ever do is use the same old idioms and the same old constructs, we're only ever going to get so much progress.

    As human beings we like the familiar and feel uncomfortable with things that take us away from it. However, it has often been shown that going outside of the comfort zone is what leads to improvement.

    A Map may be a fantastic API for a cache but you're going to struggle to convince me that it's the best option in other areas such as grid. Sure you can probably make it fit but is that the right choice?
  21. API discussion[ Go to top ]

    as Dan can tell you, I have big problems with the JavaSpaces API because -- IMHO -- it feels totally un-natural to a Java developer.)

    In respect of un-natural, I think "different" may be a better term.

    Dan, your work is a great credit to the JINI community, and I know how much you like it and really believe in it. I was careful to add "IMHO" because "natural", "unnatural", etc. are all subjective, and none of us will ever have the last word on such a conversation ;-).
    If all we ever do is use the same old idioms and the same old constructs, we're only ever going to get so much progress. As human beings we like the familiar and feel uncomfortable with things that take us away from it. However, it has often been shown that going outside of the comfort zone is what leads to improvement.

    Of course, but I (IMHO) believe that the Javaspaces API was designed in spite of existing standards and conventions. See:

    http://jroller.com/page/cpurdy?entry=the_seven_habits_of_highly2

    (Some time when we talk, I'll expand on this some more. My opinions on this particular topic are actually more caustic than I am prepared to express in public.)
    A Map may be a fantastic API for a cache but you're going to struggle to convince me that it's the best option in other areas such as grid.

    A Javaspace is just a very limited Map that puts serious restrictions on its content. That's why a commercial implementation added the Map API to their space implementation, and that's why the Javaspaces API itself is getting more and more Map-like methods added to it.

    Secondly, regarding "grids", our software addresses the data access problem for applications running in grid environments, hence we refer to it as a Data Grid.

    I don't argue for a "best option". Instead, I look at the Map API as a good "black box" that allows grid-aware implementations to be "mounted" behind it. I think with a major revision the Javaspace API could be a good "black box" API too, and that's what I've been trying to get Sun to see (with no luck so far).

    I wish you could see what our customers are doing in grid environments. We've got end-to-end algorithmic trading grids (marktet feed all the way through to execution and settlement). We provide the data backbones for some of the busiest networks in the world (e.g. equities trading, travel and logistics). We provide HA infrastructure for datacenter failover ("disaster recovery" / "continuancy planning") -- and it has proven to work (i.e. a customer's datacenter went down with no interruption to their real time grid systems running on our software).
    Sure you can probably make it fit but is that the right choice?

    I'm just curious what you like about the Javaspace API that you can't do more easily with a transactional Map that supports queries, locking, agent invocation, events and the new Java ConcurrentMap API?

    Peace,

    Cameron Purdy
    Tangosol Coherence: Clustered Shared Memory for Java
  22. API discussion[ Go to top ]

    Dan, your work is a great credit to the JINI community, and I know how much you like it and really believe in it. I was careful to add "IMHO" because "natural", "unnatural", etc. are all subjective, and none of us will ever have the last word on such a conversation ;-).

    Well, thank you and I'd agree with the subjective aspect. Yes, I do believe in JINI but I don't expect everyone to want to use it nor do I attempt to encourage that (I hope!).
    A Javaspace is just a very limited Map that puts serious restrictions on its content. That's why a commercial implementation added the Map API to their space implementation, and that's why the Javaspaces API itself is getting more and more Map-like methods added to it.

    Well that's one point of view but this feels subjective to me like a lot of the other things you and I debate. JavaSpace05 is the latest (and only standardized) API addition at this point in time and it has batching and a slightly broader event model. I personally would not view any of those as Map-like methods. What a given commercial implementation chooses to do is up to them and their mental models in respect of product usage/deployment patterns.

    I may be over-generalizing but Maps are all about lookup by key (unless you throw in the querying stuff you've added) which some people do with JavaSpaces. But there's another viewpoint which is that JavaSpaces are about flows of objects (yes, I know you don't think of JavaSpace Entry's as objects :) rather than key'd lookup.
    I don't argue for a "best option". Instead, I look at the Map API as a good "black box" that allows grid-aware implementations to be "mounted" behind it. I think with a major revision the Javaspace API could be a good "black box" API too, and that's what I've been trying to get Sun to see (with no luck so far).

    Okay, so this tweaked my interest centre - do you mean make a JavaSpace more Map like or something else? A better "black box" API to do what that you wouldn't say just use Map/Coherence? I've not been party to most of this discussion so I'm sorry if I'm asking you to repeat yourself.
    I'm just curious what you like about the Javaspace API that you can't do more easily with a transactional Map that supports queries, locking, agent invocation, events and the new Java ConcurrentMap API?

    So you'll probably shout "NDA!" at this point (and possibly "read the API" and maybe even "offline"/"phone call") but what do you do about failure of nodes actively executing agent invocations? Do you restart those invocations or report an exception and have the client request it again or something else? And in a similar vein, what happens if a client starts a transaction on a map but crashes before completing it? Oh, and one more - how about load balancing and scheduling of agent invocations? I may have several different kinds of agent/task but I might want one to have more priority than the other (or at least access to fewer servers) how do I separate out/control the amount of load they exert?

    Fundamentally I suspect we just think about things in different ways. What you find easy, I don't and vice versa it appears. I can't quite grok something that is supposedly a Map but supports all these other things as well. It just feels a little overloaded (IMHO, caveat subjective! :).

    I guess it all has to go offline and wait until we can do the chat, hopefully sometime this year.
  23. API discussion[ Go to top ]

    I guess it all has to go offline and wait until we can do the chat, hopefully sometime this year.
    Great. Finally a good, worthwhile conversation. Oh well, guess I'll go back to torturing others on other threads.
  24. API discussion[ Go to top ]

    I guess it all has to go offline and wait until we can do the chat, hopefully sometime this year.
    Great. Finally a good, worthwhile conversation. Oh well, guess I'll go back to torturing others on other threads.

    Are you petitioning for this conversation to continue in the open? Sorry, I can't quite determine the vibe from your posting.
  25. API discussion[ Go to top ]

    Are you petitioning for this conversation to continue in the open? Sorry, I can't quite determine the vibe from your posting.
    Yes and No. A little humor and a little truth. I understand you and Cameron not wanting to air "dirty laundry". There are things I am not willing really discuss in public. At the same time I am lamenting the fact that a good conversation has to handled off-line. You and Cameron seem pretty smart, and I would love to learn. People are always whining on TSS that there is no good news - but the stuff that gets the most postings has very little worth.

    Does that explain it?
  26. API discussion[ Go to top ]

    So you'll probably shout "NDA!" at this point (and possibly "read the API" and maybe even "offline"/"phone call") but what do you do about failure of nodes actively executing agent invocations? Do you restart those invocations or report an exception and have the client request it again or something else?

    The execution fails over automatically, just as if it were running on a CPU in a mainframe and the CPU dies (the thread of execution is reloaded from a checkpoint onto another CPU).
    And in a similar vein, what happens if a client starts a transaction on a map but crashes before completing it?

    The transaction is automatically rolled back and all resources associated with it are released.
    Oh, and one more - how about load balancing and scheduling of agent invocations? I may have several different kinds of agent/task but I might want one to have more priority than the other (or at least access to fewer servers) how do I separate out/control the amount of load they exert?

    The state is load-balanced, and the agents gravitate to the state, so their balancing is a derivative.

    We don't have an implementation (yet?) of prioritization of agents, outside of the ability to configure the thread pools. Only recently has it been brought up as a possible requirement, so we're still in the early "pondering stages" on that topic.

    Peace,

    Cameron Purdy
    Tangosol Coherence: The Java Data Grid
  27. API discussion[ Go to top ]

    At the point where I'm asking too many questions and should take out a support contract, let me know! :)
    The transaction is automatically rolled back and all resources associated with it are released.

    Cool, so how quickly might I expect this to happen typically? Can I configure it?
    The state is load-balanced, and the agents gravitate to the state, so their balancing is a derivative.

    So I think you're maybe saying that the way you partition the state determines how many agents I'm likely to have executing against that state? I'm probably not being clear here - let's say I have an 8-CPU machine - ideally I'd want maybe 8 threads all executing the invocation - how do I do that?
    We don't have an implementation (yet?) of prioritization of agents, outside of the ability to configure the thread pools. Only recently has it been brought up as a possible requirement, so we're still in the early "pondering stages" on that topic.

    Well, you can't address everything all at the same time can you :)
  28. API discussion[ Go to top ]

    The transaction is automatically rolled back and all resources associated with it are released.

    Cool, so how quickly might I expect this to happen typically?

    Transactions have a configurable time-out.

    Typically, node death (and failover) occur sub-second.

    "Typical" worst-case scenario is when network problems are such that node death requires several seconds to verify.
    The state is load-balanced, and the agents gravitate to the state, so their balancing is a derivative.

    So I think you're maybe saying that the way you partition the state determines how many agents I'm likely to have executing against that state? I'm probably not being clear here - let's say I have an 8-CPU machine - ideally I'd want maybe 8 threads all executing the invocation - how do I do that?

    To use multiple threads (in a standard manner), an agent can simply give a set of work items to a work manager.

    However, I've never seen this requirement. Could you describe a situation where you'd think that it would occur?

    Peace,

    Cameron Purdy
    Tangosol Coherence: The Java Data Grid
  29. API discussion[ Go to top ]

    Transactions have a configurable time-out.Typically, node death (and failover) occur sub-second."Typical" worst-case scenario is when network problems are such that node death requires several seconds to verify.

    That's a fixed length timeout right?
    To use multiple threads (in a standard manner), an agent can simply give a set of work items to a work manager.However, I've never seen this requirement. Could you describe a situation where you'd think that it would occur?

    Okay, so the question you ask makes me think I still haven't grok'd your architecture correctly! :)

    Simplistic scenario for discussion: Let's say I have 64 values that I want to perform some uniform calculation on. On an 8 CPU box, I'd ideally want to run 8 threads and have each do the computation against 8 values. On a single CPU box, I mightn't want to do that, 8 threads might thrash it.

    So the question becomes how do I go about sizing/cutting my tasks so as to get the right thread utilization across the boxes?
  30. API discussion[ Go to top ]

    Transactions have a configurable time-out.Typically, node death (and failover) occur sub-second."Typical" worst-case scenario is when network problems are such that node death requires several seconds to verify.

    That's a fixed length timeout right?

    No, it's a reflection of how fault tolerant you've configured Coherence to be for temporary network glitches.

    There is a configurable hard networking time-out, but if you hit that, it's an indication that something is REALLY wrong (e.g. a JVM bug that causes a JVM process to completely lock up but yet not be detectable as locked up by the OS.) Sun used to have such bugs in the Solaris VM .. e.g. the old "new Date().toString()" bug that would randomly lock up a JVM for five minutes.
    To use multiple threads (in a standard manner), an agent can simply give a set of work items to a work manager.However, I've never seen this requirement. Could you describe a situation where you'd think that it would occur?

    Okay, so the question you ask makes me think I still haven't grok'd your architecture correctly! :)Simplistic scenario for discussion: Let's say I have 64 values that I want to perform some uniform calculation on. On an 8 CPU box, I'd ideally want to run 8 threads and have each do the computation against 8 values. On a single CPU box, I mightn't want to do that, 8 threads might thrash it.So the question becomes how do I go about sizing/cutting my tasks so as to get the right thread utilization across the boxes?

    It's black boxed, and I haven't reviewed that part of the implementation. It could be executed on one thread or on multiple; either is possible / legal / acceptable by the API specification (i.e. within the "black box").

    Remember, all of our cache topologies (including replicated, partitioned, near, local, overflow, read-through / write-through / write-behind, etc.) support the same API, and thus support the Invocable Map API. Each can have a different implementation.

    Peace,

    Cameron Purdy
    Tangosol Coherence: The Java Data Grid
  31. API discussion[ Go to top ]

    Transactions have a configurable time-out.Typically, node death (and failover) occur sub-second."Typical" worst-case scenario is when network problems are such that node death requires several seconds to verify.
    That's a fixed length timeout right?
    No, it's a reflection of how fault tolerant you've configured Coherence to be for temporary network glitches.There is a configurable hard networking time-out, but if you hit that, it's an indication that something is REALLY wrong (e.g. a JVM bug that causes a JVM process to completely lock up but yet not be detectable as locked up by the OS.) Sun used to have such bugs in the Solaris VM .. e.g. the old "new Date().toString()" bug that would randomly lock up a JVM for five minutes.

    Ooh might be getting crossed wires, I was referring to the transaction timeout being fixed? So I was thinking if you get node death your recovery protocols trigger failover, cancel locks (pessimistic options only?) etc.

    However, if the client is doing the transaction and spins, deadlocks or whatever (i.e. not node death) for some reason, you're gonna have to wait on the transaction timeout?
  32. API discussion[ Go to top ]

    Ooh might be getting crossed wires, I was referring to the transaction timeout being fixed?

    No, it's configurable per transaction.
    So I was thinking if you get node death your recovery protocols trigger failover, cancel locks (pessimistic options only?) etc.

    Yes, that is exactly what happens.
    However, if the client is doing the transaction and spins, deadlocks or whatever (i.e. not node death) for some reason, you're gonna have to wait on the transaction timeout?

    For pessimistic transactions, yes, by definition. In that case there would be two time-outs in play: The transaction time-out and the network time-out. The first is how long resources are leased for, while the second is how long the rest of the cluster is willing to wait without any communication from the node, e.g. how long a full GC could take.

    Peace,

    Cameron Purdy
    Tangosol Coherence: Clustered Shared Memory for Java
  33. API discussion[ Go to top ]

    Ooh might be getting crossed wires, I was referring to the transaction timeout being fixed?
    No, it's configurable per transaction.

    Yah, I get that - no I meant you ask for a lease on the transaction (which is configurable per transaction as you say) but it's a fixed lease - you can't extend it?
  34. API discussion[ Go to top ]

    Ooh might be getting crossed wires, I was referring to the transaction timeout being fixed?
    No, it's configurable per transaction.

    Yah, I get that - no I meant you ask for a lease on the transaction (which is configurable per transaction as you say) but it's a fixed lease - you can't extend it?

    No, I don't believe so.

    Peace,

    Cameron Purdy
    Tangosol Coherence: Clustered Shared Memory for Java
  35. API discussion[ Go to top ]

    Ooh might be getting crossed wires, I was referring to the transaction timeout being fixed?
    No, it's configurable per transaction.
    Yah, I get that - no I meant you ask for a lease on the transaction (which is configurable per transaction as you say) but it's a fixed lease - you can't extend it?
    No, I don't believe so.Peace,Cameron PurdyTangosol Coherence: Clustered Shared Memory for Java

    Okay, so I'm missing something - can you give me a snippet of code to demonstrate?
  36. API discussion[ Go to top ]

    No, I don't believe so.

    Okay, so I'm missing something - can you give me a snippet of code to demonstrate?

    I'm not sure what your question is.

    I'm saying that I don't believe that the time-outs get extended beyond the configured time-out of the current transaction (i.e. there is no lease renewal).

    Peace,

    Cameron Purdy
    Tangosol Coherence: The Java Data Grid
  37. API discussion[ Go to top ]

    I'm not sure what your question is.I'm saying that I don't believe that the time-outs get extended beyond the configured time-out of the current transaction (i.e. there is no lease renewal).

    Ah, okay - too many negatives for me:
    .....but it's a fixed lease - you can't extend it?
    No, I don't believe so.

    I took that to mean you didn't believe I was correct on the extension thing.

    Thanks for clarifying!
  38. API discussion[ Go to top ]

    A Javaspace is just a very limited Map that puts serious restrictions on its content. That's why a commercial implementation added the Map API to their space implementation, and that's why the Javaspaces API itself is getting more and more Map-like methods added to it.

    This comment for me was very interesting in respect of the fact that it represents a view of a JavaSpace which I hadn't really considered previously.

    Coincidentally, several other things got posted on various blogs recently which all relate in one way or another. So I've posted a summary and references back up on my blog in the usual place: http://www.jroller.com/page/dancres?entry=javaspaces_maps_caches_and_flows
  39. If you are acquainted with distributed numerical computation, then you'll really like the data grid capabilities in our Coherence 3.1 release. Coherence dynamically load-balances both the data and the computations across any number of servers.
    Hi Cameron,
    Im curious (and a bit short on time ATM to read your docco), how do the classes that implement the "behaviour" get to all the nodes in your cluster?

    cheers
    craig
  40. mobile agents[ Go to top ]

    Hi Cameron, Im curious (and a bit short on time ATM to read your docco), how do the classes that implement the "behaviour" get to all the nodes in your cluster?

    Most of the time they are deployed as part of the application, i.e. the same way that the necessary Servlet classes would end up on all the Tomcat servers.

    Sometimes applications are more dynamic and need runtime distribution of classes, and we use Java's built-in class marshalling support for that. From what we've seen, this is rarely used, since new classes are not typically being introduced into a running application.

    Peace,

    Cameron Purdy
    Tangosol Coherence: Clustered Shared Memory for Java
  41. mobile agents[ Go to top ]

    Would it be fair to say then that what you have isnt really a "mobile agent" system, just an excellent way of avoiding dragging all of your distributed data back to one place to work on?
  42. mobile agents[ Go to top ]

    Would it be fair to say then that what you have isnt really a "mobile agent" system, just an excellent way of avoiding dragging all of your distributed data back to one place to work on?

    "Not dragging all of your distributed data back to one place to work on" is just one of the benefits of using an agent approach.

    What an agent is, at its simplest, is a goal-based actor operating within a relevant context of state and events. Some agent implementations provide a thread (or fibre) for each agent; we don't use that model. In our implementation, the agents within a particular context can share a configurable thread pool, so the runtime resource utilization within a particular VM can be managed. With the Invocable Map API, the agents are going to typically be short-lived, representing a single operation. In our next release, we will also support event-based agents, so if there is specific evaluations and conditional tasks that those agents have to do on state change, they can do so, and they will migrate to where the relevant data is being managed within the grid. We don't currently support timer-based a.k.a. scheduled agents, e.g. check some condition every n seconds, etc., nor do we enforce agent singularity (where the agent maintains its own state over time as it moves from one point to another within the grid), although you can accomplish that simply by storing the singular state as an entry in the grid.

    We have quite a few sources for inspiration on this topic, starting with Einar Landre (he is a big proponent of agent-based software, and we discussed this topic at Bruce Eckel's summit last year), the work of the JSR 236/237 groups that we're involved with, and from a whole bunch of ideas that our customers give us. We're not following the academic path on this topic (e.g. neural nets) but rather trying to provide the basis for building simple solutions to complex distributed programming problems.

    Peace,

    Cameron Purdy
    Tangosol Coherence: The Java Data Grid
  43. However, considering the amount of code in the tutorial, the question has to be asked: is there a simpler way to approach this? Should there be?

    Well, some of the code in the init method (which is by far the largest piece of code) is basically still boilerplate and could easily be placed in a generic helper class. In particular the bits associated with building a proxy, and the configuration stuff (which in this case is just the usual export control and configuration stuff).

    'Course, I'm not going to say it's perfect (nothing ever is). There are various tools around that make this even easier like the Inca X plugins for Eclipse etc.
  44. However, considering the amount of code in the tutorial, the question has to be asked: is there a simpler way to approach this? Should there be?
    Well, some of the code in the init method (which is by far the largest piece of code) is basically still boilerplate and could easily be placed in a generic helper class. In particular the bits associated with building a proxy, and the configuration stuff (which in this case is just the usual export control and configuration stuff).'Course, I'm not going to say it's perfect (nothing ever is). There are various tools around that make this even easier like the Inca X plugins for Eclipse etc.
    Dan, if it's boilerplated stuff, perhaps it should indeed be put in a helper class - or at the very least, a helper library (think of how commons-mail handles the typical case of *just wanting to send a freakin' email!*)
  45. Dan, if it's boilerplated stuff, perhaps it should indeed be put in a helper class - or at the very least, a helper library (think of how commons-mail handles the typical case of *just wanting to send a freakin' email!*)

    Looking at the code a number of the first lines are to do with setting up defaults.

    As far as the exporting goes, there is a lot to do and keep track of when you export a remote object in Jini, because there are a number of ways to do it. I have been working on something of a library to do with exporting etc. and keeping track of all this stuff, that basically takes the remote object builds the exporter, wraps the remote reference, possibly adds in support for secure remote calls and smart proxies, and it does it like this.

    _proxy = (Queue) DefaultExporterManager.getManager().exportProxy(this, "Service", UuidFactory.generate());

    with definitions for "Service" defined in a configuration file like

    <code>

    import net.jini.jeri.*;
    import net.jini.jeri.http.*;

    ExportManager {
        mgrDefs = new String[]{"Service"};
    }


    ExportManager.Service{
    exporterClass = BasicJeriExporter.class;
            serverEndpoint = HttpServerEndpoint.getInstance(0);
            ILFactory = new BasicILFactory();
        proxyCreator = new QueueServiceCreator();
    }
    </code>

    This removes the need to setup the exporter in code, and keep track of everything, because it can import a lot of this information from the configuration file and manage the remote object (independent of how it is exported) for you.

    I'll get it released, if anyone wants to take it out for a test drive.

    --Calum
  46. Seems like Spring and Aspects could help alot.
  47. Seems like Spring and Aspects could help alot.

    Okay, that's a bit opaque for me - could you give an example of your thinking please?
  48. Define service interface.
    Write generic proxy that will look up actual JINI service proxy and delegate calls to it.

    Same concept applied to EJB, RMI and WebServices.
  49. Define service interface.Write generic proxy that will look up actual JINI service proxy and delegate calls to it.Same concept applied to EJB, RMI and WebServices.

    Ah, gotcha not where my mind was going - thanks for the clarification!
  50. Generic Proxy[ Go to top ]

    Its possible to listen to service registration and deregistration events, then you can bind the service proxies into jndi meaning that your service lookup becomes a jndi lookup.

    Using a "ServiceLocator" or whatever means that this can then be generified into the same framework as your ejbs. No spring or aspects needed!

    James
  51. Generic Proxy[ Go to top ]

    Correct me if I am wrong, but most JINI services are not stubs (that can be binded to JNDI) but actual classes that get dynamically loaded into client JVM. Can JNDI do the same?
  52. Generic Proxy[ Go to top ]

    You are right.

    However, by binding a Reference into JNDI

      context.bind( jndiName, new Reference(className, factory, null) );

    and having the factory implement getObjectInstance, and use a ServiceDiscoveryManager/LookupCache you can look up the service in the same way as normal, but via JNDI.

    James