Resin PHP Functions
Resin 3.1

Documentation
Examples
Changes

Overview
Installation
Configuration
Quercus
SOA/IoC
JSP
Servlets and Filters
Admin (JMX)
EJB
Amber
Security
Performance
Hessian
XML and XSLT
Third-party
Troubleshooting/FAQ

Overview
Security
Java Integration
Resin Module
Module Status
List of PHP Applications
Troubleshooting/FAQ
Java Integration
Quercus
Module Status

Quercus provides a number of Resin-specific function to integrate with JNDI, JMS, JMX, and provide extra debugging.

jndi_lookup

Retrives an object from JNDI. jndi_lookup is useful in a SOA (Service Oriented Architecture) system to locate a Java service.

<?php

$conn = jndi_lookup("java:comp/env/jms/jms-connection-factory");
$queue = jndi_lookup("java:comp/env/jms/test-queue");

...
?>
mbean_explode

Explodes a JMX ObjectName into an array.

mbean_explode
<?php

var_dump(mbean_explode("resin:type=WebApp,name=/foo,Host=bar.com"));

?>
array(4) {
  [":domain:"]=>
  string(5) "resin"
  ["Host"]=>
  string(7) "bar.com"
  ["name"]=>
  string(4) "/foo"
  ["type"]=>
  string(6) "WebApp"
}
mbean_implode

Creates a JMX ObjectName from an array.

mbean_implode
<?php

$a = array(":domain:"=>"resin", "type" => "ThreadPool");

var_dump(mbean_implode($a));

?>
resin:type=ThreadPool
MBeanServer

An object representing a JMX MBeanServer.

<?php

$mbeanServer = new MBeanServer();

$threadPool = $mbeanServer->lookup("resin:type=ThreadPool");

echo "thread-max: " . $threadPool->threadMax;

lookup

Returns a proxy to the mbean matching the given name.

<?php

$mbeanServer = new MBeanServer();

$threadPool = $mbeanServer->lookup("resin:type=ThreadPool");

query

Returns mbean proxies matching the name pattern.

<?php

$mbeanServer = new MBeanServer();

foreach ($webApp in $mbeanServer->query("resin:type=WebApp,*")) {
  echo $webApp->name . "<br>\n";
}
resin_debug

Write debugging information to the log. The log is at INFO level.

resin_thread_dump
<?php

$a = array("a", "b");

resin_debug("ARRAY: $a[0]");

?>
resin_thread_dump

Produce a thread_dump to the logs. The log is at INFO level.

resin_thread_dump
<?php

$a = array("a"=>"b");

resin_thread_dump();

?>
resin_call_stack

Returns an array containing the current PHP function call stack.

resin_call_stack
<?php

function foo()
{
  bar();
}

function bar()
{
  var_dump(resin_call_stack());
}

foo();

?>
resin_var_dump

Produce a var_dump to the logs. The log is at INFO level.

resin_var_dump
<?php

$a = array("a"=>"b");

resin_var_dump($a);

?>
resin_version

Returns the version of Resin running Quercus.

<?php

var_dump(resin_version());

?>
xa_begin

Starts a distributed transaction. All database connections will automatically participate in the transaction. Returns TRUE for success, FALSE for failure.

<?php

xa_begin();

...

xa_commit();
?>
xa_commit

Commits a distributed transaction. All database connections will automatically participate in the transaction. Returns TRUE for success, FALSE for failure.

<?php

xa_begin();

...

xa_commit();
?>
xa_rollback

Rolls back a distributed transaction. All database connections will automatically participate in the transaction. Returns TRUE for success, FALSE for failure.

<?php

xa_begin();

...

xa_rollback();
?>
xa_rollback_only

Marks the current distributed transaction as rollback only. Subsequent attempts to commit the transaction will fail with a warning. Returns TRUE for success, FALSE for failure.


Java Integration
Quercus
Module Status
Copyright © 1998-2006 Caucho Technology, Inc. All rights reserved.
Resin ® is a registered trademark, and Quercustm, Ambertm, and Hessiantm are trademarks of Caucho Technology.