This paper takes the impact of charging and discharging operations on battery degradation into consideration, and studies the optimal energy management policy for an energy harvesting communication system under a battery usage constraint. Specifically, in each time slot, we assume the harvested energy can be used to power the transmitter immediately without entering into the battery, or stored into the battery for now and retrieved later for transmission. Whenever the battery is charged or discharged, a cost will be incurred to account for its impact on battery degradation. We impose an long-term average cost constraint on the battery, which is translated to the average number of charge/discharge operations per unit time. The objective is to develop an online policy to maximize the long-term average throughput of the transmitter under energy causality constraint and the battery usage constraint. We first relax the energy causality constraint on the system, and impose an energy flow conservation constraint instead. We show that the optimal energy management policy has a double-threshold structure: if the amount of energy arrives in each time slot lies in between the two thresholds, it will be used immediately without involving the battery; otherwise, the battery will be charged or discharged accordingly to maintain a constant transmit power. We then modify the double-threshold policy slightly to accommodate the energy causality constraint, and analyze its long-term performance. We show that the system achieves the same long-term average performance, thus it is optimal.