# Class Context<R extends Resource>

java.lang.Object
jdk.crac.Context<R>

All Implemented Interfaces:
  `Resource`

public abstract class Context<R extends Resource> extends Object implements Resource
A `Resource` that allows other `Resource`s to be registered with it.

`Context` implementation overrides `beforeCheckpoint` and `afterRestore`, defining how the notification about checkpoint and restore will be distributed by the `Context` hierarchy.

A `Context` implementor is encouraged to respect properties of the global `Context`.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`Context()`
Creates a `Context`.

## Method Summary

Modifier and Type
Method
Description
`abstract void`
`afterRestore(Context<? extends Resource> context)`
Invoked by a `Context` as a notification about restore.
`abstract void`
`beforeCheckpoint(Context<? extends Resource> context)`
Invoked by a `Context` as a notification about checkpoint.
`abstract void`
`register(R resource)`
Registers a `Resource` with this `Context`.

### Methods declared in class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### Context

protected Context()
Creates a `Context`.

## Method Details

### beforeCheckpoint

public abstract void beforeCheckpoint(Context<? extends Resource> context) throws CheckpointException
Description copied from interface: `Resource`
Invoked by a `Context` as a notification about checkpoint.

Specified by:
  `beforeCheckpoint` in interface `Resource`
Parameters:
  `context` - `Context` providing notification
Throws:
  `CheckpointException`

### afterRestore

public abstract void afterRestore(Context<? extends Resource> context) throws RestoreException
Description copied from interface: `Resource`
Invoked by a `Context` as a notification about restore.

Specified by:
  `afterRestore` in interface `Resource`
Parameters:
  `context` - `Context` providing notification
Throws:
  `RestoreException`

### register

public abstract void register(R resource)
Registers a `Resource` with this `Context`.

Parameters:
  `resource` - `Resource` to be registered.
Throws:
  `NullPointerException` - if `resource` is `null`