Skip to content

Commit

Permalink
fixup again
Browse files Browse the repository at this point in the history
  • Loading branch information
lincolnthree committed Oct 3, 2013
1 parent e7b4877 commit 0df73f4
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions news/2013-10-03-post-forge-2.0.0.Alpha13.released.textile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ h2. Resource Transactions and Resource Change Monitoring

There are a lot of exciting features (as you can see by the release notes below); however, there are some outstanding features that we are proud to present. The first of which are resource transactions and monitoring.

* Resource Transactions:
h3. Resource Transactions:

If you are familiar with UserTransaction in Java EE applications, this should feel pretty comfortable.

<code>
<pre lang="java">
ResourceTransaction transaction = factory.getTransaction();
try {
// Starts the transaction
Expand All @@ -46,32 +46,32 @@ try {
// Discard all changes since the beginning of this transaction
transaction.rollback();
}
</code>
</pre>

Additionally, transactions support change-set inspection, so you can compare file contents before deciding whether or not a given transaction should be committed or rolled back:

<code>
<pre lang="java">
...
Collection<ResourceEvent> changeSet = transaction.getChangeSet();
...
transaction.commit();
</code>
</pre>

Following the example above, this change set contains the following entries:

<code>
<pre lang="java">
Collection [
ResourceCreated: <FileResource<?>>,
ResourceModified: <DirectoryResource>,
ResourceModified: <FileResource<?>>,
ResourceDeleted: <FileResource<?>>,
ResourceCreated: <FileResource<?>>
]
</code>
</pre>

* Resource Monitors:
h3. Resource Monitors:

<code>
<pre lang="java">
@Inject
private ResourceFactory factory;
...
Expand All @@ -83,12 +83,12 @@ monitor.addResourceListener(new ResourceListener() {
...
}
});
</code>
</pre>
Once a monitor is no longer needed, it must be manually disposed of by calling the cancel() method:

<code>
<pre lang="java">
monitor.cancel();
</code>
</pre>

h3. @CommandScoped support:

Expand Down

0 comments on commit 0df73f4

Please sign in to comment.