@@ -39,13 +39,14 @@ public static DynamicEngine getInstance() {
3939
4040 /**
4141 * 刷新instance
42- * @throws TaskException
42+ *
43+ * @throws TaskException
4344 */
4445 public static void flush (URLClassLoader classLoader ) throws TaskException {
4546 ourInstance = new DynamicEngine (classLoader );
4647 // if class load change , to flush all task
4748 synchronized (StaticValue .MAPPING ) {
48- StaticValue .getBean (TaskService .class , "taskService" ).initTaskFromDB ();
49+ StaticValue .getSystemIoc (). get (TaskService .class , "taskService" ).initTaskFromDB ();
4950 }
5051
5152 }
@@ -122,9 +123,9 @@ public Class<?> javaCodeToClass(String fullClassName, String javaCode) throws IO
122123 clazz = dynamicClassLoader .loadClass (fullClassName , jco );
123124 } catch (Exception e ) {
124125 e .printStackTrace ();
125- LOG .error (e .getMessage (),e );
126+ LOG .error (e .getMessage (), e );
126127 } catch (Error e ) {
127- LOG .error (e .getMessage (),e );
128+ LOG .error (e .getMessage (), e );
128129 throw new CodeException (e .toString ());
129130 } finally {
130131 if (dynamicClassLoader != null ) {
@@ -141,8 +142,7 @@ public Class<?> javaCodeToClass(String fullClassName, String javaCode) throws IO
141142
142143 return clazz ;
143144 }
144-
145-
145+
146146 public byte [] javaCode2Bytes (String fullClassName , String javaCode ) throws IOException , CodeException {
147147 Class <?> clazz = null ;
148148 JavaCompiler compiler = ToolProvider .getSystemJavaCompiler ();
@@ -152,7 +152,7 @@ public byte[] javaCode2Bytes(String fullClassName, String javaCode) throws IOExc
152152 jfiles .add (new CharSequenceJavaFileObject (fullClassName , javaCode ));
153153
154154 List <String > options = new ArrayList <String >();
155-
155+
156156 options .add ("-source" );
157157 options .add ("1.6" );
158158 options .add ("-target" );
@@ -162,7 +162,6 @@ public byte[] javaCode2Bytes(String fullClassName, String javaCode) throws IOExc
162162 options .add ("-classpath" );
163163 options .add (this .classpath );
164164 options .add ("-parameters" );
165-
166165
167166 JavaCompiler .CompilationTask task = compiler .getTask (null , fileManager , diagnostics , options , null , jfiles );
168167 boolean success = task .call ();
@@ -178,12 +177,12 @@ public byte[] javaCode2Bytes(String fullClassName, String javaCode) throws IOExc
178177 dynamicClassLoader .loadClass (name , inner );
179178 }
180179 }
181- return jco .getBytes () ;
180+ return jco .getBytes ();
182181 } catch (Exception e ) {
183182 e .printStackTrace ();
184- LOG .error (e .getMessage (),e );
183+ LOG .error (e .getMessage (), e );
185184 } catch (Error e ) {
186- LOG .error (e .getMessage (),e );
185+ LOG .error (e .getMessage (), e );
187186 throw new CodeException (e .toString ());
188187 } finally {
189188 if (dynamicClassLoader != null ) {
@@ -198,7 +197,7 @@ public byte[] javaCode2Bytes(String fullClassName, String javaCode) throws IOExc
198197 throw new CodeException (error .toString ());
199198 }
200199
201- return null ;
200+ return null ;
202201 }
203202
204203 public <T > T javaCodeToObject (String fullClassName , String javaCode ) throws IllegalAccessException , InstantiationException , IOException , CodeException {
@@ -239,9 +238,4 @@ public URLClassLoader getParentClassLoader() {
239238 return parentClassLoader ;
240239 }
241240
242- public Class <?> javaCodeToClassFile (String string , String sourcePath ) {
243- // TODO Auto-generated method stub
244- return null ;
245- }
246-
247241}
0 commit comments