celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Björn Petri <bjoern.pe...@sundevil.de>
Subject Re: Remote service using shared mem
Date Mon, 16 Sep 2013 10:54:17 GMT

Am 2013-09-16 10:00, schrieb Alexander Broekhuis:
> Out of curiosity and for compatibility with Java, is there also some 
> java
> support for it? I am still interested in writing a java version as 
> well.
> Maybe you could provide some technical details on the working of it.

The whole netstring spec is quite straightforward 
(http://cr.yp.to/proto/netstrings.txt). Hence it should not be that 
difficult to use it in Java. Probably there are already some 
implementations available.

>> Also note that shared memory segments or semaphores might be left in 
>> the
>> system and needs to be removed manually (see ipcs, ipcrm) when CELIX 
>> does
>> not shutdown as expected.
> Did you use APR for this? Or doesn't APR support semaphores etc? I 
> haven't
> looked at it at all, but using APR would be great.

I used the apr_shm routines, but unfortunately I could not use 
apr_global_mutex routines as the re-opening of the mutex in a child 
process only works if you have the pointer to the original created mutex 
available, which in turn could not be saved in the shared memory as 
apr_shm does not support fixed addresses for the shared memory 

> Also, does the code check if there is anything left when starting 
> again?

It does check and although tries to attach to the shared memory if 
available. But it is a little bit more tricky for the semaphores as 
there might be the need to re-initalize them. Especially for the 
discovery part - using the current implementation it is not possible to 
determine whether there is already another celix instance running which 
has initialized those semaphores or whether they have been left from an 
segfaulting celix.


View raw message