|
| 1 | +/******************************************************************************* |
| 2 | + * Copyright (c) 2010 java2script.org and others. |
| 3 | + * All rights reserved. This program and the accompanying materials |
| 4 | + * are made available under the terms of the Eclipse Public License v1.0 |
| 5 | + * which accompanies this distribution, and is available at |
| 6 | + * http://www.eclipse.org/legal/epl-v10.html |
| 7 | + * |
| 8 | + * Contributors: |
| 9 | + * Zhou Renjian - initial API and implementation |
| 10 | + *******************************************************************************/ |
| 11 | + |
| 12 | +package net.sf.j2s.ajax; |
| 13 | + |
| 14 | +/** |
| 15 | + * Providing a comet way for given Simple RPC, in case RPC takes a long time. |
| 16 | + * For server side only. |
| 17 | + * |
| 18 | + * @author zhou renjian |
| 19 | + * |
| 20 | + * 2012-08-30 |
| 21 | + */ |
| 22 | +public interface ISimpleCometable { |
| 23 | + |
| 24 | + /** |
| 25 | + * Return whether job will be run in comet or not. |
| 26 | + * |
| 27 | + * @return Returning true, {@link #cometRun(Runnable)} will be invoked. |
| 28 | + * Return false, SimpleRPCRunnable#ajaxRun() will be invoked. |
| 29 | + */ |
| 30 | + public boolean supportsCometMode(); |
| 31 | + |
| 32 | + /** |
| 33 | + * Try to run RPC, if running in comet mode, return true, else return false. |
| 34 | + * |
| 35 | + * @param doneCallback provided by server, will not be null. |
| 36 | + * @return Returning false, call-back must not be invoked. Returning true, |
| 37 | + * call-back must be called when its job is done. Otherwise, this |
| 38 | + * connection will be kept until server restarts. |
| 39 | + */ |
| 40 | + public boolean cometRun(Runnable asyncDoneCallback); |
| 41 | + |
| 42 | +} |
0 commit comments