📄 job.java
字号:
/* * Copyright (C) 2004 OntoText Lab, Sirma AI OOD * * Address: * Europe 135 Tsarigradsko Shose, Sofia 1784, Bulgaria * (IT Center Office Express, 3rd floor) * * North America 438 Isabey Str, Suite 103, Montreal, Canada H4T 1V3 * * Phone: (+359 2) 9768 310 * Fax: (+359 2) 9768 311 * * * E-mail: info@ontotext.com * Web: http://www.ontotext.com * Sirma Group International Corp. http://www.sirma.com * Sirma AI Ltd. http://www.sirma.bg * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */package org.openrdf.util.rmirouting;import java.io.Serializable;/** * <p>Title: RMI routing</p> * <p>Description: The Job class represent a single invocation of a method * returning 'void' that has been invoked only with native and seralizable * arguments. This si very usefull way to batch several invocation of a such * king into a single RMI call so to reduce the net trafic. </p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: Ontotext Lab. Sirma AI</p> * @author Damyan Ognyanoff * @version 1.0 */class Job implements Serializable { /** * The description of the method being invoked. Actually, it is a char array * which begins with the name of the method followed by the names of the * classes of its arguments. All these substrings are separated by '|' * character. The description is parsed on the other side of the channel * and it is used to locate and invoke that method on the reflected instance * there. */ char[] methodDescription; /** * the actual arguments used within the method call. They should be either * instances imeplemnting <code>java.io.Serializable</code> or be some of the java native * types e.g. byte, char, etc. */ byte[] serializedArgs; /** * constructor * @param <code>methodDescription<code> of the method to be batched * @param <code>args<code> used for the method call */ public Job(char[] methodDescription, Object[] args) { this.methodDescription = methodDescription; java.io.ByteArrayOutputStream buf = new java.io.ByteArrayOutputStream(2048); try { java.io.ObjectOutputStream oo = new java.io.ObjectOutputStream(buf); oo.writeObject(args); } catch (java.io.IOException e) { e.printStackTrace(); // should throw some exception here } this.serializedArgs = buf.toByteArray(); } /** * second constructor that receive a method description as String * @param <code>m<code> the description of the method invoked * @param <code>args<code> used for the the method call */ public Job(String m, Object[] args) { this(m.toCharArray(), args); }} //Job
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -