Skip to content

Commit

Permalink
Implement java.io.Flushable wherever applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed Oct 14, 2013
1 parent 8b1927f commit 7479419
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,8 @@

package org.springframework.transaction;

import java.io.Flushable;

/**
* Representation of the status of a transaction.
*
Expand All @@ -34,7 +36,7 @@
* @see org.springframework.transaction.support.TransactionCallback#doInTransaction
* @see org.springframework.transaction.interceptor.TransactionInterceptor#currentTransactionStatus()
*/
public interface TransactionStatus extends SavepointManager {
public interface TransactionStatus extends SavepointManager, Flushable {

/**
* Return whether the present transaction is new (else participating
Expand Down Expand Up @@ -79,6 +81,7 @@ public interface TransactionStatus extends SavepointManager {
* Flush the underlying session to the datastore, if applicable:
* for example, all affected Hibernate/JPA sessions.
*/
@Override
void flush();

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,8 @@

package org.springframework.transaction.support;

import java.io.Flushable;

/**
* Interface to be implemented by transaction objects that are able to
* return an internal rollback-only marker, typically from a another
Expand All @@ -29,7 +31,7 @@
* @since 1.1
* @see DefaultTransactionStatus#isRollbackOnly
*/
public interface SmartTransactionObject {
public interface SmartTransactionObject extends Flushable {

/**
* Return whether the transaction is internally marked as rollback-only.
Expand All @@ -43,6 +45,7 @@ public interface SmartTransactionObject {
* Flush the underlying sessions to the datastore, if applicable:
* for example, all affected Hibernate/JPA sessions.
*/
@Override
void flush();

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,8 @@

package org.springframework.transaction.support;

import java.io.Flushable;

/**
* Interface for transaction synchronization callbacks.
* Supported by AbstractPlatformTransactionManager.
Expand All @@ -34,7 +36,7 @@
* @see org.springframework.jdbc.datasource.DataSourceUtils#CONNECTION_SYNCHRONIZATION_ORDER
* @see org.springframework.orm.hibernate3.SessionFactoryUtils#SESSION_SYNCHRONIZATION_ORDER
*/
public interface TransactionSynchronization {
public interface TransactionSynchronization extends Flushable {

/** Completion status in case of proper commit */
int STATUS_COMMITTED = 0;
Expand Down Expand Up @@ -65,6 +67,7 @@ public interface TransactionSynchronization {
* for example, a Hibernate/JPA session.
* @see org.springframework.transaction.TransactionStatus#flush()
*/
@Override
void flush();

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@
package org.springframework.http.server;

import java.io.Closeable;
import java.io.Flushable;
import java.io.IOException;

import org.springframework.http.HttpOutputMessage;
Expand All @@ -28,7 +29,7 @@
* @author Arjen Poutsma
* @since 3.0
*/
public interface ServerHttpResponse extends HttpOutputMessage, Closeable {
public interface ServerHttpResponse extends HttpOutputMessage, Flushable, Closeable {

/**
* Set the HTTP status code of the response.
Expand All @@ -37,10 +38,11 @@ public interface ServerHttpResponse extends HttpOutputMessage, Closeable {
void setStatusCode(HttpStatus status);

/**
* Ensure the headers and the content of the response are written out. After the first
* flush, headers can no longer be changed, only further content writing and flushing
* is possible.
* Ensure that the headers and the content of the response are written out.
* <p>After the first flush, headers can no longer be changed.
* Only further content writing and content flushing is possible.
*/
@Override
void flush() throws IOException;

/**
Expand Down

0 comments on commit 7479419

Please sign in to comment.