Re: IKVM and Apache Curator listner
Lams Yi <[email protected]>
| Newsgroups | gmane.comp.java.ikvm.devel |
|---|---|
| Message-ID | <CAMhKGbOqsXnmZQTBF65De1Z6H7WP3pxVWn_qg+N6zUq=c=4rvg@mail.gmail.com> |
It turn out I need to implement the UnhandledErrorListener like follow:
public class ClientUnhandledErrorListener : UnhandledErrorListener
{
public void unhandledError(string str, Exception t)
{
// Implement handle error logic here
}
}
Once I done that, I can handle the event without issue.
On Wed, Jul 30, 2014 at 7:46 PM, Lams Yi <[email protected]> wrote:
> Hi,
>
> I try to use Apache Curator with .Net under IKVM.
>
> Here is the java code I try to covert to C#. And here is the java doc:
> http://curator.apache.org/apidocs/org/apache/curator/framework/listen/ListenerContainer.html#addListener(T)
>
> --------------------------------------------------------
> CuratorFramework client =
> CuratorFrameworkFactory.newClient(server.getConnectString(), new
> RetryOneTime(1));
> client.start();
> try
> {
> client.create().creatingParentsIfNeeded().forPath("/test/foo",
> "one".getBytes());
>
> client.getUnhandledErrorListenable().addListener
> (
> new UnhandledErrorListener()
> {
> @Override
> public void unhandledError(String message, Throwable e)
> {
> error.set(e);
> }
> }
> );
> --------------------------------------------------------
>
> In IKVM, the Listenable interface become:
>
> --------------------------------------------------------
> using IKVM.Attributes;
> using java.util.concurrent;
>
> namespace org.apache.curator.framework.listen
> {
> [Signature("<T:Ljava/lang/Object;>Ljava/lang/Object;")]
> public interface Listenable
> {
> [Signature("(TT;)V")]
> void addListener(object obj);
>
> [Signature("(TT;Ljava/util/concurrent/Executor;)V")]
> void addListener(object obj, Executor e);
>
> [Signature("(TT;)V")]
> void removeListener(object obj);
> }
> }
> --------------------------------------------------------
>
>
> My question is: how can I create a listener in C# and map the
> Java anonymous function as the above sample?
>
> Thanks,
>
> Tao
>
>
>
>
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Ikvm-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ikvm-developers