I am trying to add arguments in RMI method. When I add e.g. String
everything works fine. But I am not sure if I can pass an object I created. I am new to RMI s
Your object should implement Serializable
. As I can see this would be one problem. It is needed because the communication between both parts is done using serialization, so each object that needs to be sent to the other part, needs to be an instance of class implementing Serializable
.
public class Context implements Serializable
{
private String requestType;
private String distributedThreadName;
private List<Long> IDList;
(...) getters/setters
}
and please add a serialVersionUID
as a good practice. Something like:
private static final long serialVersionUID = 20120731125400L;