---
title: "The Process Facet"
url: https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# The Process Facet

Parts of this page are for some programming languages only, and name them. For one language's text alone, see [C++](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet/java.md), [JavaScript](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet/js.md), [MATLAB](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet/matlab.md), [PHP](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet/php.md), [Python](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet/python.md), [Ruby](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet/ruby.md), and [Swift](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet/swift.md).

The `Process` facet lets a location service, such as [IceGrid](https://docs.zeroc.com/ice/3.8/services/icegrid.md), request a graceful shutdown of a server. (C++, C#, Java, Python, and Swift: The communicator can register a proxy for this facet with the location service, as described in [Registering the Process Facet with the Location Service](#registering-the-process-facet-with-the-location-service).)

> **C++, C#, Java, MATLAB, PHP, Python, Ruby, and Swift**
>
> > **Note**
> >
> > Be aware of the [security considerations](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/security-considerations-for-administrative-facets.md) associated with enabling the `Process` facet.

## The `Process` Interface

The `Process` facet implements the `Ice::Process` ([C++](https://code.zeroc.com/ice/3.8/api/cpp/classIce_1_1ProcessPrx.html), [C#](https://code.zeroc.com/ice/3.8/api/csharp/api/Ice.ProcessPrx.html), [Java](https://code.zeroc.com/ice/3.8/api/java/com.zeroc.ice/com/zeroc/Ice/ProcessPrx.html), [JavaScript](https://code.zeroc.com/ice/3.8/api/javascript/Ice/ProcessPrx.html), [Python](https://code.zeroc.com/ice/3.8/api/python/Ice.ProcessPrx.html), [Ruby](https://code.zeroc.com/ice/3.8/api/ruby/Ice/ProcessPrx.html), and [Swift](https://code.zeroc.com/ice/3.8/api/swift/documentation/ice/processprx)) interface:

- `shutdown` initiates a graceful shutdown of the program, which can take some time to complete. An IceGrid node that calls `shutdown` [terminates the server](https://docs.zeroc.com/ice/3.8/services/icegrid/icegrid-and-the-administrative-facility.md#deactivating-a-deployed-server) when the shutdown takes too long.
- `writeMessage` prints a message to the program's standard output (`fd` 1) or standard error (`fd` 2).

> **C++, C#, Java, Python, and Swift**
>
> ## Graceful Shutdown
>
> The default `Process` facet calls `shutdown` on the [communicator](https://docs.zeroc.com/ice/3.8/runtime/communicator.md). This shuts down the server through a convention that Ice servers follow: the shutdown of the communicator is the signal to exit. The main thread of the server waits for this shutdown, for example by calling `waitForShutdown`, then cleans up and exits.
>
> ## Replacing the Process Facet
>
> To shut the program down differently, replace the default `Process` facet with a servant that implements `Ice::Process`. Set [Ice.Admin.DelayCreation](https://docs.zeroc.com/ice/3.8/property-reference/ice-admin-properties.md#ice.admin.delaycreation) to `1`, so that the communicator does not create the admin object during initialization:
>
> ```config
> Ice.Admin.DelayCreation=1
> ```
>
> Then remove the default facet, add your own, and call `getAdmin` to create the admin object:
>
> > **C++**
> >
> > ```cpp
> > // MyProcess implements Ice::Process
> > auto myProcessFacet = std::make_shared<MyProcess>(...);
> >
> > communicator->removeAdminFacet("Process");
> > communicator->addAdminFacet(myProcessFacet, "Process");
> > communicator->getAdmin();
> > ```
>
> > **C#**
> >
> > ```csharp
> > // MyProcess implements Ice.Process
> > var myProcessFacet = new MyProcess(...);
> >
> > communicator.removeAdminFacet("Process");
> > communicator.addAdminFacet(myProcessFacet, "Process");
> > communicator.getAdmin();
> > ```
>
> > **Java**
> >
> > ```java
> > // MyProcess implements com.zeroc.Ice.Process
> > var myProcessFacet = new MyProcess(...);
> >
> > communicator.removeAdminFacet("Process");
> > communicator.addAdminFacet(myProcessFacet, "Process");
> > communicator.getAdmin();
> > ```
>
> > **Python**
> >
> > ```py
> > # MyProcess implements Ice.Process
> > myProcessFacet = MyProcess(...)
> >
> > communicator.removeAdminFacet("Process")
> > communicator.addAdminFacet(myProcessFacet, "Process")
> > communicator.getAdmin()
> > ```
>
> > **Swift**
> >
> > ```swift
> > // MyProcess implements Ice.Process
> > let myProcessFacet = MyProcess(...)
> >
> > try communicator.removeAdminFacet("Process")
> > try communicator.addAdminFacet(servant: myProcessFacet, facet: "Process")
> > _ = try communicator.getAdmin()
> > ```
>
> ## Registering the Process Facet with the Location Service
>
> If [Ice.Admin.ServerId](https://docs.zeroc.com/ice/3.8/property-reference/ice-admin-properties.md#ice.admin.serverid) is set and the communicator has a default locator, the communicator registers a proxy for the `Process` facet with the locator registry after creating the admin object, by calling `setServerProcessProxy` with the value of `Ice.Admin.ServerId`.
>
> With [IceGrid](https://docs.zeroc.com/ice/3.8/services/icegrid.md), this value is the ID of the server in its deployment: IceGrid sets `Ice.Admin.ServerId` and `Ice.Default.Locator` for each server that it deploys. When the descriptor of the server defines neither [Ice.Admin.Endpoints](https://docs.zeroc.com/ice/3.8/property-reference/ice-admin-properties.md) nor `Ice.Admin.Enabled`, IceGrid also sets `Ice.Admin.Endpoints` to `tcp -h 127.0.0.1`.

## See Also

- [Communicator](https://docs.zeroc.com/ice/3.8/runtime/communicator.md)
- [Securing the admin Object](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/security-considerations-for-administrative-facets.md)
- [Creating the admin Object](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/creating-the-admin-object.md)
- [Using the admin Object](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/using-the-admin-object.md)
- [Ice.Admin.\*](https://docs.zeroc.com/ice/3.8/property-reference/ice-admin-properties.md)
- [IceGrid](https://docs.zeroc.com/ice/3.8/services/icegrid.md)
