what's wrong with my Entry?
alexandre alessi <[email protected]>
| Newsgroups | gmane.comp.java.sun.javaspaces |
|---|---|
| Message-ID | <[email protected]> |
i 'm being use the jini 2.0 (outrigger)
when i try to take my entry, i get a
Transaction: net.jini.core.transaction.server.ServerTransaction
[manager=com.sun.jini.mahalo.TxnMgrProxy$ConstrainableTxnMgrProxy@4e87e98d,
id=-598171133175857004]
at com.sun.jini.outrigger.SpaceProxy.entryFrom(SpaceProxy.java:556)
at com.sun.jini.outrigger.SpaceProxy.take(SpaceProxy.java:420)
at framework.TaskMonitor.monitoring(TaskMonitor.java:77)
at framework.TaskMonitor.run(TaskMonitor.java:38)
i was defined my entry as here (the comments are in portuguese):
public interface Task extends Entry
{
AbstractResult execute();
}
public abstract class AbstractTask implements Task, Runnable,Framework
{
public Uuid groupUuid;
public Long taskId;
public Boolean processed = new Boolean (false);
public JavaSpace space;
public Transaction txn;
public AbstractResult result;
public Double java_specification_version;
public void run()
{
long ti = System.currentTimeMillis();
result = execute();
long tf = System.currentTimeMillis();
if (result != null)
{
this.result.time = new Long (tf - ti);
try
{
space.write(result,null,FOREVER);
}
catch (Exception e)
{
e.printStackTrace();
try
{
txn.abort();
}
catch (Exception ex)
{
e.printStackTrace();
}
}
}
}
public abstract AbstractResult execute();
}
public class GenericTask extends AbstractTask
{
public GenericTask()
{
}
public AbstractResult execute()
{
throw new RuntimeException("Método execute() não implementado.");
}
}
public class TaskPrimos extends GenericTask
{
public ResultPrimos resultado;
public Integer length;
public Integer [] nums;
public Integer [] primos;
public Integer quant=new Integer(0);
public TaskPrimos()
{
}
public TaskPrimos(Integer nums[])
{
this.length = new Integer(nums.length);
this.nums = nums;
}
public Boolean isPrime(int num)
{
double raiz = Math.sqrt(num);
for (int i=2;i<=raiz;i++)
{
if (num % i == 0)
{
return new Boolean (false);
}
}
return new Boolean (true);
}
public AbstractResult execute()
{
int j=0;
ResultPrimos resultado = new ResultPrimos();
for (int i=0;i<length.intValue();i++)
{
if (isPrime(nums[i].intValue()).booleanValue())
{
primos[j++] = nums[i];
quant = new Integer(j);
}
}
System.out.println("passou por aqui");
resultado.quant = quant;
resultado.primos = primos;
return resultado;
}
}
===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JAVASPACES-USERS". For general help, send email to
[email protected] and include in the body of the message "help".
To view past JAVASPACES-USERS postings, please see:
http://archives.java.sun.com/archives/javaspaces-users.html
JDC members can download the JavaSpaces(tm) Technology from:
http://developer.java.sun.com/developer/products/jini/