Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force serialized class reloading #81

Open
quidproquo opened this issue Jul 8, 2014 · 2 comments
Open

Force serialized class reloading #81

quidproquo opened this issue Jul 8, 2014 · 2 comments

Comments

@quidproquo
Copy link

Is there a way force reloading of serialized classes that are associated with GridClosures? I have an example program that has a closure which makes use of inner classes but when those inner classes are changed, I get an exception. When I change the serialVersionUID of the serialized classes, I get a different exception saying that I need to make sure the class is loaded on all nodes. Is there a way to force a reload if the serialized version changes?

@dsetrakyan
Copy link

Can you provide a sample code to reproduce?

@quidproquo
Copy link
Author

Initial code:

public class CalculateStatisticsTask extends GridComputeTaskSplitAdapter<List<Map<String, String>>, List<Statistics>> {

    private static final long serialVersionUID = 1L;

    @Override
    protected Collection<? extends GridComputeJob> split(int gridSize, List<Map<String, String>> axeses) {
        Collection<GridComputeJob> jobs = new LinkedList<>();

        for (final Map<String, String> axes : axeses) {
            jobs.add(new GridComputeJobAdapter() {

                private static final long serialVersionUID = 1L;

                @Nullable
                @Override
                public Object execute() {
                    System.out.println("Axes: xyz");
                }

            });
        }

        return jobs;
    }
    // ...
}

I run this task from a client node and have an remote node running in a terminal window. It prints out the "Axes: xyz" which is fine. However, if I change the code to print out something else ("Axes: abc"), the remote node still prints out the old String. If i change the serialVersionUID to a new value, I get the following exception:

Caused by: java.lang.ClassNotFoundException: Optimized stream class checksum mismatch (is same version of marshalled class present on all nodes?)

From reading the documentation on "Zero Deployment," it says:

Moreover, GridGain supports redeployment, so, you don’t have to restart the nodes every time you change the task or closure code - again, just modify the code, compile, and run, and all your changes will be picked up on the grid automatically.

However, it doesn't seem to pickup the new code at all. I was testing if changing the serialVersionUID would do that. Is there a way to pickup the new code without restarting the remote node?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants