org.springframework.remoting.RemoteTimeoutException Java Examples

The following examples show how to use org.springframework.remoting.RemoteTimeoutException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JmsInvokerTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void receiveTimeoutExpired() {
	JmsInvokerProxyFactoryBean pfb = new JmsInvokerProxyFactoryBean() {
		@Override
		protected Message doExecuteRequest(Session session, Queue queue, Message requestMessage) throws JMSException {
			return null; // faking no message received
		}
	};
	pfb.setServiceInterface(ITestBean.class);
	pfb.setConnectionFactory(this.mockConnectionFactory);
	pfb.setQueue(this.mockQueue);
	pfb.setReceiveTimeout(1500);
	pfb.afterPropertiesSet();
	ITestBean proxy = (ITestBean) pfb.getObject();

	assertThatExceptionOfType(RemoteTimeoutException.class).isThrownBy(() ->
			proxy.getAge())
		.withMessageContaining("1500 ms")
		.withMessageContaining("getAge");
}
 
Example #2
Source File: JmsInvokerTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void receiveTimeoutExpired() {
	JmsInvokerProxyFactoryBean pfb = new JmsInvokerProxyFactoryBean() {
		@Override
		protected Message doExecuteRequest(Session session, Queue queue, Message requestMessage) throws JMSException {
			return null; // faking no message received
		}
	};
	pfb.setServiceInterface(ITestBean.class);
	pfb.setConnectionFactory(this.mockConnectionFactory);
	pfb.setQueue(this.mockQueue);
	pfb.setReceiveTimeout(1500);
	pfb.afterPropertiesSet();
	ITestBean proxy = (ITestBean) pfb.getObject();

	thrown.expect(RemoteTimeoutException.class);
	thrown.expectMessage("1500 ms");
	thrown.expectMessage("getAge");
	proxy.getAge();
}
 
Example #3
Source File: JmsInvokerTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void receiveTimeoutExpired() {
	JmsInvokerProxyFactoryBean pfb = new JmsInvokerProxyFactoryBean() {
		@Override
		protected Message doExecuteRequest(Session session, Queue queue, Message requestMessage) throws JMSException {
			return null; // faking no message received
		}
	};
	pfb.setServiceInterface(ITestBean.class);
	pfb.setConnectionFactory(this.mockConnectionFactory);
	pfb.setQueue(this.mockQueue);
	pfb.setReceiveTimeout(1500);
	pfb.afterPropertiesSet();
	ITestBean proxy = (ITestBean) pfb.getObject();

	thrown.expect(RemoteTimeoutException.class);
	thrown.expectMessage("1500 ms");
	thrown.expectMessage("getAge");
	proxy.getAge();
}
 
Example #4
Source File: JmsInvokerClientInterceptor.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Callback that is invoked by {@link #executeRequest} when the receive
 * timeout has expired for the specified {@link RemoteInvocation}.
 * <p>By default, an {@link RemoteTimeoutException} is thrown. Sub-classes
 * can choose to either throw a more dedicated exception or even return
 * a default {@link RemoteInvocationResult} as a fallback.
 * @param invocation the invocation
 * @return a default result when the receive timeout has expired
 */
protected RemoteInvocationResult onReceiveTimeout(RemoteInvocation invocation) {
	throw new RemoteTimeoutException("Receive timeout after " + this.receiveTimeout + " ms for " + invocation);
}
 
Example #5
Source File: JmsInvokerClientInterceptor.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Callback that is invoked by {@link #executeRequest} when the receive
 * timeout has expired for the specified {@link RemoteInvocation}.
 * <p>By default, an {@link RemoteTimeoutException} is thrown. Sub-classes
 * can choose to either throw a more dedicated exception or even return
 * a default {@link RemoteInvocationResult} as a fallback.
 * @param invocation the invocation
 * @return a default result when the receive timeout has expired
 */
protected RemoteInvocationResult onReceiveTimeout(RemoteInvocation invocation) {
	throw new RemoteTimeoutException("Receive timeout after " + this.receiveTimeout + " ms for " + invocation);
}
 
Example #6
Source File: JmsInvokerClientInterceptor.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Callback that is invoked by {@link #executeRequest} when the receive
 * timeout has expired for the specified {@link RemoteInvocation}.
 * <p>By default, an {@link RemoteTimeoutException} is thrown. Sub-classes
 * can choose to either throw a more dedicated exception or even return
 * a default {@link RemoteInvocationResult} as a fallback.
 * @param invocation the invocation
 * @return a default result when the receive timeout has expired
 */
protected RemoteInvocationResult onReceiveTimeout(RemoteInvocation invocation) {
	throw new RemoteTimeoutException("Receive timeout after " + this.receiveTimeout + " ms for " + invocation);
}