33
33
import org .jgroups .blocks .RpcDispatcher ;
34
34
import org .jgroups .fork .ForkChannel ;
35
35
import org .unitime .commons .hibernate .util .HibernateUtil ;
36
+ import org .unitime .localization .impl .Localization ;
36
37
import org .unitime .timetable .onlinesectioning .OnlineSectioningServer ;
37
38
import org .unitime .timetable .onlinesectioning .OnlineSectioningServerContext ;
38
39
import org .unitime .timetable .solver .SolverProxy ;
@@ -85,13 +86,14 @@ public boolean createRemoteSolver(String sessionId, DataProperties config, Addre
85
86
}
86
87
87
88
@ Override
88
- public Object invoke (String method , String sessionId , Class [] types , Object [] args ) throws Exception {
89
+ public Object invoke (String method , String sessionId , String locale , Class [] types , Object [] args ) throws Exception {
89
90
try {
90
91
OnlineSectioningServer solver = iInstances .get (Long .valueOf (sessionId ));
91
92
if ("exists" .equals (method ) && types .length == 0 )
92
93
return solver != null ;
93
94
if (solver == null )
94
95
throw new Exception ("Server " + sessionId + " does not exist." );
96
+ if (locale != null ) Localization .setLocale (locale );
95
97
return solver .getClass ().getMethod (method , types ).invoke (solver , args );
96
98
} catch (InvocationTargetException e ) {
97
99
if (e .getTargetException () != null && e .getTargetException () instanceof Exception )
@@ -106,7 +108,10 @@ public Object invoke(String method, String sessionId, Class[] types, Object[] ar
106
108
@ Override
107
109
public Object dispatch (Address address , String sessionId , Method method , Object [] args ) throws Exception {
108
110
try {
109
- return iDispatcher .callRemoteMethod (address , "invoke" , new Object [] { method .getName (), sessionId , method .getParameterTypes (), args }, new Class [] { String .class , String .class , Class [].class , Object [].class }, SolverServerImplementation .sFirstResponse );
111
+ return iDispatcher .callRemoteMethod (address , "invoke" ,
112
+ new Object [] { method .getName (), sessionId , Localization .getLocale (), method .getParameterTypes (), args },
113
+ new Class [] { String .class , String .class , String .class , Class [].class , Object [].class },
114
+ SolverServerImplementation .sFirstResponse );
110
115
} catch (InvocationTargetException e ) {
111
116
if (e .getTargetException () != null && e .getTargetException () instanceof Exception )
112
117
throw (Exception )e .getTargetException ();
0 commit comments