setasign\SetaPDF2\Core\Reader

MaxFileHandler Class that handles MaxFileReader instances.

File: /SetaPDF v2/Core/Reader/MaxFileHandler.php
Old class name (alias): \SetaPDF_Core_Reader_MaxFileHandler

It is responsible for observing the open file handles and ensures that a specific limit is not reached by setting other instances into sleep-mode.

Class hierarchy

Summary

Properties

$_instances

The reader instances

$_maxOpenHandles

protected int MaxFileHandler::$_maxOpenHandles = 1000

Maximum open handles

$_openHandles

protected int MaxFileHandler::$_openHandles = 0

Currently open handles.


Methods

__construct()

public MaxFileHandler::__construct (
int $maxOpenHandles = 1000
)

The constructor.

Parameters
$maxOpenHandles : int
 

createReader()

Helper method to create a reader instance.

Parameters
$filename : string
 
Exceptions

Throws Exception

See

ensureFreeHandle()

public MaxFileHandler::ensureFreeHandle (
void
): void

Ensures a free handle.

getInstances()

Get all reader instances registered in this handler instance.

getMaxOpenHandles()

public MaxFileHandler::getMaxOpenHandles (
void
): int

Get the maximum open handles.

getOpenHandles()

public MaxFileHandler::getOpenHandles (
void
): int

Get the currently opened handles count.

onHandleClosed()

public MaxFileHandler::onHandleClosed (
void
): void

Shall be triggered if a handle is closed.

onHandleOpened()

public MaxFileHandler::onHandleOpened (
void
): void

Shall be triggered if a handle is opened.

setMaxOpenHandles()

public MaxFileHandler::setMaxOpenHandles (
int $maxOpenHandles
): void

Set the maximum open handles.

Parameters
$maxOpenHandles : int