Results 1 to 4 of 4

Thread: Problem with ice_invoke_async on java

  1. #1
    smandy is offline Registered User
    Name: Andy Smith
    Organization: Self Employed
    Project: Learning Ice
    Join Date
    Mar 2009
    Posts
    17

    Problem with ice_invoke_async on java

    Hi All,

    Am having trouble getting the ice_invoke_async function to work in java.

    I don't seem to see any existing example for this function, so I've modified the Client.java file in the examples to perform what ( to my mind) should be an asyncronous equivalent of the synchronous printString example. ( Option '0' has been added').

    I've verified the synchronous version works. But when I try to call the asynchronous version an assertion is thrown.

    Am I calling the function in the right way? Also just to understand how assertions are used in the code, to my mind an assertion should never be called in working library code and if they're called it always signifies a bug, is this the right way of thinking about them, or are there occasions when a user can cause an assertion to be raised? I'd normally expect all user mistakes to raise exceptions instead.

    Any help appreciated!

    A.


    Using Ice-3.3.1....

    Output
    =========================
    (Assertions enabled)

    usage:
    0: async pring string
    1: print string
    2: print string sequence
    3: print dictionary
    4: print enum
    5: print struct
    6: print struct sequence
    7: print class
    8: get values
    9: throw exception
    s: shutdown server
    x: exit
    ?: help

    ==> 1 ( Here server outputs "Printing string `The streaming API works!'" as expected).
    ==> 0
    ==> Exception in thread "Ice.ThreadPool.Client-0" java.lang.AssertionError
    at IceInternal.BasicStream.getReadEncapsSize(BasicStr eam.java:506)
    at Ice.AMI_Object_ice_invoke.__response(AMI_Object_ic e_invoke.java:40)
    at IceInternal.OutgoingAsync.__finished(OutgoingAsync .java:201)
    at Ice.ConnectionI.message(ConnectionI.java:964)
    at IceInternal.ThreadPool.run(ThreadPool.java:577)
    at IceInternal.ThreadPool.access$100(ThreadPool.java: 12)
    at IceInternal.ThreadPool$EventHandlerThread.run(Thre adPool.java:971)


    ( Without Assertions enabled)
    ==> 0
    ==> 14/08/09 09:34:08:569 warning: Ice.ThreadPool.Client-0: exception raised by AMI callback:
    java.lang.NullPointerException
    at IceInternal.BasicStream.getReadEncapsSize(BasicStr eam.java:507)
    at Ice.AMI_Object_ice_invoke.__response(AMI_Object_ic e_invoke.java:40)
    at IceInternal.OutgoingAsync.__finished(OutgoingAsync .java:201)
    at Ice.ConnectionI.message(ConnectionI.java:964)
    at IceInternal.ThreadPool.run(ThreadPool.java:577)
    at IceInternal.ThreadPool.access$100(ThreadPool.java: 12)
    at IceInternal.ThreadPool$EventHandlerThread.run(Thre adPool.java:971)



    $ java -version
    java version "1.6.0_13"
    Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
    Java HotSpot(TM) Client VM (build 11.3-b02, mixed mode, sharing)
    Attached Files Attached Files

  2. #2
    dwayne's Avatar
    dwayne is offline ZeroC Staff
    Name: Dwayne Boone
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Jan 2005
    Location
    St. John's, Newfoundland
    Posts
    397
    Thanks for the report, this is a bug in Ice and not an issue with your code. I have uploaded a source distribution patch here that fixes the problem.

    One other note. In your sample code you check the return code of ice_invoke_async and print "Unknown user execption" if it returns false. For ice_invoke_async the return code does not indicate whether a exception occurred, but instead whether or not the operation was invoked synchronously.
    Dwayne Boone

  3. #3
    smandy is offline Registered User
    Name: Andy Smith
    Organization: Self Employed
    Project: Learning Ice
    Join Date
    Mar 2009
    Posts
    17
    Hi,

    Thanks a lot for fixing so quickly!

    I think my return value checking is a copy/paste error from the synchronous example :-( . (Thanks for pointing that out as well!)

    A.

  4. #4
    smandy is offline Registered User
    Name: Andy Smith
    Organization: Self Employed
    Project: Learning Ice
    Join Date
    Mar 2009
    Posts
    17
    Hi Again,

    Just to confirm I've rebuild ice with the patch and the bug is gone. Thanks again!
    A.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. some problem in communication between c++ and java
    By yunying in forum Help Center
    Replies: 2
    Last Post: 03-14-2010, 10:27 PM
  2. Replies: 0
    Last Post: 08-14-2009, 09:27 AM
  3. ice_invoke/ice_invoke_async return value
    By apwd in forum Help Center
    Replies: 1
    Last Post: 11-05-2008, 05:20 AM
  4. Java StringHolder problem
    By RHaar in forum Help Center
    Replies: 2
    Last Post: 05-28-2008, 09:17 PM
  5. Ice Context propagation problem (C++, Java)
    By joel vennin in forum Help Center
    Replies: 2
    Last Post: 04-20-2006, 11:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •